Has anyone tried sIEve the leak detector for IE (http://home.wanadoo.nl/jsrosman/) with GWT applications and noticed its reporting unexpected references to elements that are removed from the page?
Attached is a sample which reproduces this and is trying to simulate somewhat what we do in our application.
It creates a widget using UiBinder and attach to a panel. On a button click, this UI is removed.
With sIEve, we are seeing that even after the UI is removed, there are still some references left to it and is reported as orphaned nodes.
To reproduce:
1) Run the attached project as Web Application
2) Open sIEve-0.0.8.exe downloaded from the URL http://home.wanadoo.nl/jsrosman/
3) Provide the URL in sIEve as e.g. http://127.0.0.1:8888/UiBinderSample.html?gwt.codesvr=127.0.0.1:9997
4) Click on the button 'Remove' on the page
5) Click on 'Show in use' in sIEve
There it reports that for the element with id 'panel1' there are still 3 references to it. This was the UI that was removed from the DOM on button click and the member variable pointing to it was set to null. So ideally there shouldn't be any references to it at that point. So it looks like there are some references from GWT itself and since the page is still active it will never be freed when the garbage collector runs.
It also shows that the tag 'OPTION' has still 2 references left to it.
Now to remove references to 'OPTINON', go to the file MyComposite.java and un-comment the following code in the method destroy():
for (int i = listBox.getItemCount(); i > 0; i--)
listBox.removeItem(i - 1);
then repeat the above steps, you will see that now there is one reference less reported on to the 'OPTION' elements. So by explicitly removing the elements from the option list, we are able to remove the references to it(ListBox.clear() isn't doing the job btw). I think the one reference left now is the one from sIEve itself
I would have expected that when removeFromParent() is called and the variable is set to null, there would be no reference to those elements.
So I am looking for a way to make the number of references to panel1 to 0 when I remove it from UI. In our main application we create and remove widgets. As we remove the widgets from UI not all memory used by it is getting released, and we suspect the references like this is causing a leak.
Thanks for any help on this
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment