release memory in GlobalResourceHandler

Hello,

I have an application in which I’m displaying PDF documents

BrowserWindowOpener opener = new BrowserWindowOpener(PreviewPopupUI.class);

public class PreviewPopupUI extends UI
{

public void displayPreviewWindow(String sText,byte arbyData,String sFilename)
{

    StreamResource resource =
            new StreamResource(new PDFSource(arbyData), sFilename );
        String sContentType = getContentTypeByFileName(sFilename);

        Window window = new Window();  
        window.setResizable(true);
        window.setCaption(sText);
        window.setSizeFull();
        window.setModal(true);
        window.center();


        e = new Embedded();
        e.setSizeFull();
        e.setType(Embedded.TYPE_BROWSER);
        resource.setMIMEType(sContentType);
        e.setSource(resource);
        window.setContent(e);
        this.addWindow(window);


}

the problem is that after I’m closing the UI (not the window which is inside ) the memory is not released (when I’m closing first the window which is inside the UI the memory is released OK).
Using a profiler, I saw the all the stream resources are kept inside resourceUsers variable of the GlobalResourceHandler class.

Any ideea how can I release the memory ?
Thank you

I found a solution :

this.addDetachListener(new DetachListener() {

        @Override
        public void detach(DetachEvent event) {
            // TODO Auto-generated method stub
            PreviewPopupUI.this.getConnectorTracker().cleanConnectorMap();
        }
    });