1. #1
    Ext User
    Join Date
    Mar 2009
    Posts
    4
    Vote Rating
    0
    splilly is on a distinguished road

      0  

    Default Psudo Memory Leak

    Psudo Memory Leak


    Hi. I have an issue where the memory usage of the browser continues to grow throughout the running of my gwt / gxt application. It would appear that some memory is lost / leaked due to the use of gxt. Using only gwt based widgets does not cause the memory leak. As a simple test case I tried rapidly creating and removing a gxt "ContentPanel" and you can watch the browser memory increase. My sample is so simple that I can't see how it could be anything I am doing wrong so I'm assuming it is a bug in gxt.

    My sample is composed of 3 java files. I'll post them here for others to verify.

    GWT 1.5.3
    GXT 1.2.3
    IE6
    Last edited by splilly; 3 Mar 2009 at 11:03 AM. Reason: More info

  2. #2
    Ext User
    Join Date
    Mar 2009
    Posts
    4
    Vote Rating
    0
    splilly is on a distinguished road

      0  

    Default Entry Point

    Entry Point


    Code:
    package net.example.client;
    
    import com.google.gwt.core.client.EntryPoint;
    import com.google.gwt.user.client.Timer;
    import com.google.gwt.user.client.ui.Button;
    import com.google.gwt.user.client.ui.ClickListener;
    import com.google.gwt.user.client.ui.RootPanel;
    import com.google.gwt.user.client.ui.VerticalPanel;
    import com.google.gwt.user.client.ui.Widget;
    
    /**
     * Entry point classes define <code>onModuleLoad()</code>.
     */
    public class MemTest implements EntryPoint {
        private VerticalPanel mainPanel;
    
        public void onModuleLoad() {
            mainPanel = new VerticalPanel();
    
            final Timer replaceSampleWidget = new Timer() {
                @Override
                public void run() {
                    if (mainPanel.getWidgetCount() > 3) {
                        mainPanel.remove(3);
                    }
                    SampleWidget innerPanel = new SampleWidget();
                    mainPanel.add(innerPanel);
                }
            };
    
            final Timer replaceSampleWidgetWithGxt = new Timer() {
                @Override
                public void run() {
                    if (mainPanel.getWidgetCount() > 3) {
                        mainPanel.remove(3);
                    }
                    SampleWidgetWithGxt innerPanel = new SampleWidgetWithGxt();
                    mainPanel.add(innerPanel);
                }
            };
            
            Button start = new Button("Start without Gxt", new ClickListener() {
                public void onClick(Widget arg0) {
                    replaceSampleWidget.scheduleRepeating(50);
                }
            });
    
            Button startWithGxt = new Button("Start with Gxt", new ClickListener() {
                public void onClick(Widget arg0) {
                    replaceSampleWidgetWithGxt.scheduleRepeating(50);
                }
            });
            
            Button stop = new Button("Stop", new ClickListener() {
                public void onClick(Widget arg0) {
                    replaceSampleWidget.cancel();
                    replaceSampleWidgetWithGxt.cancel();
                }
            });
            mainPanel.add(start);
            mainPanel.add(startWithGxt);
            mainPanel.add(stop);
            RootPanel.get().add(mainPanel);
        }
    }

  3. #3
    Ext User
    Join Date
    Mar 2009
    Posts
    4
    Vote Rating
    0
    splilly is on a distinguished road

      0  

    Default Sample Widget (GWT only, No Leak)

    Sample Widget (GWT only, No Leak)


    package net.example.client;

    import com.google.gwt.user.client.ui.Composite;
    import com.google.gwt.user.client.ui.Label;
    import com.google.gwt.user.client.ui.VerticalPanel;

    public class SampleWidget extends Composite {
    private static int count = 0;
    private VerticalPanel content;

    public SampleWidget() {
    content = new VerticalPanel();
    content.add(new Label("Testing " + count++));
    initWidget(content);
    }
    }

  4. #4
    Ext User
    Join Date
    Mar 2009
    Posts
    4
    Vote Rating
    0
    splilly is on a distinguished road

      0  

    Default SampleWidgetWithGxt.java (Memory Leak)

    SampleWidgetWithGxt.java (Memory Leak)


    package net.example.client;

    import com.extjs.gxt.ui.client.widget.ContentPanel;
    import com.google.gwt.user.client.ui.Composite;
    import com.google.gwt.user.client.ui.Label;
    import com.google.gwt.user.client.ui.VerticalPanel;
    import com.google.gwt.user.client.ui.Widget;

    public class SampleWidgetWithGxt extends Composite {
    private static int count = 0;
    private VerticalPanel content;

    public SampleWidgetWithGxt() {
    content = new VerticalPanel();
    content.add(new Label("Testing " + count++));
    content.add(createGxt());
    initWidget(content);
    }

    public Widget createGxt() {
    ContentPanel panel = new ContentPanel();
    panel.setFrame(true);
    return panel;
    }
    }

  5. #5
    Ext User
    Join Date
    Oct 2008
    Posts
    35
    Vote Rating
    0
    sbarkdull is on a distinguished road

      0  

    Default Same problem, and it's severe

    Same problem, and it's severe


    I have an application that uses a content panel and 2 grid controls. The grids are refreshed every 30 seconds with new data from the server. On every grid refresh, the memory consumption increases, and never decreases.

    My current theory is that there is a memory leak in the grid's store's loader.

    This is making my application unusable after about 30-60 minutes of operation.

    This problem is a total show stopper for my app (which is in production).

    This problem shows on all browsers I've tested with (FFox, Safari, IE, Chrome).

    Google claims the GWT is memory - leak - proof, so I am focusing my attention on the possibility that the problem is in GXT.

    Does anyone know of any good tools for debugging javascript memory leaks in the browser?

  6. #6
    Software Architect
    Join Date
    Sep 2007
    Posts
    13,971
    Vote Rating
    132
    sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light

      0  

    Default


    You should try to reproduce the grid issue in a minimal example. I dont see this.

    ALso i cant reproduce the issue from the first posts anymore with gwt 1.2 from SVN

  7. #7
    Ext User
    Join Date
    Oct 2008
    Posts
    35
    Vote Rating
    0
    sbarkdull is on a distinguished road

      0  

    Default Moving to GWT 1.7 and GXT 2.0

    Moving to GWT 1.7 and GXT 2.0


    I am hoping that moving to the newer versions (GWT 1.7 and GXT 2.0) of the 2 toolkits/frameworks will resolve some of the leaks I am seeing.

    If not, I'll develop a minimal example to try to demo the problem.

  8. #8
    Ext User
    Join Date
    Sep 2008
    Posts
    1
    Vote Rating
    0
    Baus is on a distinguished road

      0  

    Default Memory Leak

    Memory Leak


    Hi,
    we have created a enterprise application with GWT-Ext.
    This problem makes us very worried at the time (After 30 min., We have 1.6 GB in memory. (Task Mananger)).

    We are considering to switch to GXT.
    But this is a problem if GXT has the same problem.

    My question is, how GXT deal with the problem?

    THX
    Johann

  9. #9
    Software Architect
    Join Date
    Sep 2007
    Posts
    13,971
    Vote Rating
    132
    sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light

      0  

    Default


    GXT2, which i suggest you should use, has no known memoryleaks. Also the last development version of GXT 1.2 doesnt has a known one.

  10. #10
    Ext User
    Join Date
    Oct 2008
    Posts
    35
    Vote Rating
    0
    sbarkdull is on a distinguished road

      0  

    Default Oh really?

    Oh really?


    I just located and reported a memory leak in GXT 2.0 in the GridView's refresher (GridView.refresh()). One of EXT JS's engineers confirmed the memory leak, and had a fix ready to be checked in as of some time last week.

    The engineer said: "This was already reported before and i have the fix already ready. It will be in SVN today and will be part of GXT 2.0.3 ", I believe his name was Sven.

    Based on my application's memory usage patterns, I am concerned that there may be a memory leak in the GridView's loader.

Thread Participants: 3