PDA

View Full Version : How to release memory when a TabItem is closed



vdhanda
16 Oct 2008, 11:15 AM
When a TabItem is closed or explicitly removed from a TabPanel, what is the best way to release the memory? It doesn't seem that the memory is released automatically. Ex. If we run the Explorer demo and open several tabs and close them the memory usage doesn't decrease.

Is this expected behavior? A bug? Am I missing an obvious method call? Anyone?

skhan
14 Nov 2008, 7:36 AM
Any updates on this issue.
We're trying to improve the performance on our application and have encountered the same problem.

LINEMAN78
14 Nov 2008, 7:41 AM
Your browser is what does the garbage collection for you. If it is no longer attached to the DOM anywhere, then it should be collected. To check to see if it is still connected to the DOM, I suggest using the Firebug plug-in for Firefox, as it will still show it if it is simply hidden. It will be dimmed out, but still there.

skhan
14 Nov 2008, 8:41 AM
Ah yes, the joys of javascript GC...
I did look at it with Firebug and as far as I could tell it was being removed from the DOM, but even after leaving my browser open overnight the memory was never reclaimed.
My only thought is that maybe it's still being referenced somewhere else, but I thought GWT was supposed to worry about that, not me.
Then again I might be completely confused about the browser GC process and not have a clue of what I'm talking about.

LINEMAN78
14 Nov 2008, 8:47 AM
My experience has been that the GC of the browser is slightly more aggressive than Java, but I have not used the GXT tab panel. According to some developers, you should not have memory leaks in using GWT unless you start writing your own native listeners:

http://groups.google.com/group/Google-Web-Toolkit/browse_thread/thread/928f136c5942cdeb/ecd0df1e87d7ebb0?lnk=gst&q=javascript+memory+leaks

It might help if you post the code that does your removing of the tab.

skhan
14 Nov 2008, 8:57 AM
Yeah, I have that link bookmarked.
I have no code that actually removes the tab. I just assumed that hitting the close icon in the top right hand corner of the tab header would take care of all my needs.

I'll try and put together a demo illustrating my problem and post the code here.

skhan
14 Nov 2008, 12:51 PM
Didn't want to hijack the OPs thread so I started a new one here:
http://extjs.com/forum/showthread.php?p=251094