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 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 after the UI is removed, there are still some references to it left 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
Attached is a sample which 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 after the UI is removed, there are still some references to it left 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 shoudn't be any references to it at that point.
It also shows that the tag 'OPTION' has still 2 references left to it.
Now if you 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 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 forcefully remove the references to panel1. In our main application we create and remove widgets. As we remove the widgets from UI not all memory is getting released, and we suspect the references like this is causing a leak.
Thanks for any help on this,
dw
No comments:
Post a Comment