PDA

View Full Version : I.E. Memory Leak GWT vs. GXT



glewis321
24 Oct 2011, 10:16 AM
All-
I have been experiencing I.E. memory leak problems so I created a simple test with GWT only and then included GXT libraries. I am using a timer to refresh the webpage every 1second to test this memory leak. When using the GWT only, see excerpt below, over a 48 hour period with I.E. or Firefox I found no memory heap increase at 20MB and 38MB respectively.
28844

When running the GXT code below I.E’s heap grew to >1GB in just 6 minutes whereas the Firefox process grew to only 70MB.

When using GXT are there specific memory release methods we should be using that null out variables in addition to the .removeAll() method ViewPort? See msdn article: http://msdn.microsoft.com/en-us/library/bb250448(v=vs.85).aspx

- GXT version: 2.2.5
- GWT version: 2.4.0
- Host mode/web mode/both: web mode
- Browser and version: I.E. 7/8/9
- Operating System: Windows (XP and 7)
- Sample code:

GWT


public class TestApp implements EntryPoint {

VerticalPanel centerPanel = new VerticalPanel();
Timer refreshTimer = new Timer() {
public void run() {
updateGUI();
schedule(500);
}
};

public void onModuleLoad() {
RootPanel.get().add(centerPanel);
refreshTimer.schedule(1000);
}

public void updateGUI(){
centerPanel.clear();
VerticalPanel mainPanel = new VerticalPanel();
for(int i = 0; i < 300; i++){
TextBox tb = new TextBox();
tb.setSize("250", "25");
tb.setText(new Date().toString());
mainPanel.add(tb);
}
centerPanel.add(mainPanel);
}
}


GXT


public class TestApp implements EntryPoint {
LayoutPanel centerPanel = new LayoutPanel();
Timer refreshTimer = new Timer() {
public void run() {
updateGUI();
schedule(1000);
}
};

public void onModuleLoad() {
Viewport viewport = new Viewport();
viewport.setLayout(new BorderLayout());
BorderLayoutData data = new BorderLayoutData(LayoutRegion.CENTER);
viewport.add(centerPanel, data);
RootPanel.get().add(viewport);
refreshTimer.schedule(1000);
}

private void updateGUI() {
centerPanel.clear();
VerticalPanel mainPanel = new VerticalPanel();
for (int i = 0; i < 300; i++) {
TextBox tb = new TextBox();
tb.setSize("250", "25");
tb.setText(new Date().toString());
mainPanel.add(tb);
}
centerPanel.add(mainPanel);
}
}


Thanks for your help,
Greg

Colin Alworth
24 Oct 2011, 8:07 PM
Thanks for the report, I'm trying to understand it now to see what might be causing the results you are seeing.

In the sample labeled GXT, I see several classes used - VerticalPanel and TextBox, as well as RootPanel, the same classes used in the GWT sample.

Another question - in your testing process, are you actually refreshing the page through some means, or do you mean that the timer is going off at regular intervals to create new widgets and append them to the page? If you are actually refreshing the browser (i.e. the page ends and a new page load starts), this would appear to be a real memory leak, as opposed to a difficult to reach object - can you share how you are achieving a regular refresh?

This isn't a big deal, but one of your images didnt appear to post correctly, just as a link to D:/Profiles... on your computer, which we can't see.

glewis321
25 Oct 2011, 7:11 AM
I pasted in the wrong text yesterday somehow when I was using the code tags. I updated it today. Sorry.

I am not performing a browser refresh. I am using the timer to update the widgets on the page. After looking at this again, it seams the issue might be within the GWT class LayoutPanel.

I next incorporated one of the widgets, a Grid, that I am using my my application into the test app using as much only GXT code as I could. I used the sample code GridExample as a way to quickly populate the Grid. Same result with IE memory growth and stable Firefox memory.



public class TestApp implements EntryPoint {
LayoutContainer centerPanel = new LayoutContainer();
Timer refreshTimer = new Timer() {
public void run() {
updateGUI();
schedule(1000);
}
};

public void onModuleLoad() {
RootPanel.get().add(centerPanel);
refreshTimer.schedule(1000);
}

private void updateGUI() {
centerPanel.removeAll();
centerPanel.add(new GridExample());
centerPanel.layout();
}
}

cartr
4 Nov 2011, 6:31 AM
I am also having issues with IE memory leaks with a background timer refreshing a grid on my page. I'm trying to look into how to profile this, but mine is a slower leak; over the course of a night, if my page is left open, I'll come in the next morning and it will have crashed.

micgala
15 Nov 2011, 8:38 AM
Is this problem being looked at?

It would be great if it could be avoided at least on gxt 3.