Comment by GlacieredPyro:
I'm sitting with a situation where either my code is horribly bad and I
should not be in the development industry or there is something wrong.
The following short code sample will "leak". In IE 7/8 the odds of getting
memory back are slim to none. FF2 gives some back and chrome(using the dev
tools) releases most if not all. However the Chrome memory footprint using
perfmon private bytes tracking also "leaks" (so it does not reflect what
the chrome snapshots show).
Could this be a case of insufficient tools to truly track browser memory
usage?
I have after days of research found no answers. The code sample should be
self explanatory :
{{{
public class ARGH implements EntryPoint {
VerticalPanel dpFields = new VerticalPanel();
/**
* This is the entry point method.
*/
public void onModuleLoad() {
HorizontalPanel dp = new HorizontalPanel();
dp.setHeight("120");
RootPanel.get().add(dp);
dp.add(new Button("Add", new ClickHandler() {
public void onClick(ClickEvent evt) {
TextBox t;
for(int i = 0; i < 100; i++) {
t = new TextBox();
t.setText("TextField " + i);
t.setWidth("200");
dpFields.add(t);
}
}
}));
dp.add(new Button("Clear", new ClickHandler() {
public void onClick(ClickEvent evt) {
dpFields.clear();
}
}));
dp.add(new Button("Reset", new ClickHandler() {
public void onClick(ClickEvent evt) {
dpFields.clear();
RootPanel.get().remove(dpFields);
dpFields = new VerticalPanel();
dpFields.setHeight("200");
RootPanel.get().add(dpFields);
}
}));
dpFields.setHeight("200");
RootPanel.get().add(dpFields);
}
}
}}}
For more information:
http://code.google.com/p/google-web-toolkit/wiki/DomEventsAndMemoryLeaks
--
http://groups.google.com/group/Google-Web-Toolkit-Contributors