1. #1
    Ext User
    Join Date
    Jul 2008
    Posts
    9
    Vote Rating
    0
    cdaller is on a distinguished road

      0  

    Default [FIXED] memory leak in combobox?

    [FIXED] memory leak in combobox?


    Hi!

    we are experiencing that the browser (IE6, IE7 and Firefox) uses more and more memory in our application. We are using input forms a lot and traced back the problem to the usage of the ComboBox widget.

    I wrote a little demo for the problem that interactively allows to
    - add 50 Html widgets to a container
    - add 50 Comboboxes to a container
    - remove all widgets from the container

    I tried to follow the memory consumption in window's taskmanager when doing the following actions:
    1. add 50 Html Widgets (multiple times if you want)
    2. clear
    3. note the memory size of iexplorer (the first clear results in less memory than on startup of the application, no idea why)
    4. add 50 html widgets (multiple times if you want)
    5. clear
    6. the memory is about the same as in step 3
    7. add 50 comboboxes
    8. clear
    9. the memory did not go down on clearing the comboboxes and shows the same result as after step 7

    I tried to do the same with IESieve, but there neither memory nor dom objects go down ever. So I am not sure if there is a problem with IESieve or my code :-)

    The code to test:
    Code:
    package testmemoryleak.client;
    
    import com.extjs.gxt.ui.client.Style.Scroll;
    import com.extjs.gxt.ui.client.data.BaseModel;
    import com.extjs.gxt.ui.client.event.ComponentEvent;
    import com.extjs.gxt.ui.client.event.SelectionListener;
    import com.extjs.gxt.ui.client.store.ListStore;
    import com.extjs.gxt.ui.client.widget.Html;
    import com.extjs.gxt.ui.client.widget.LayoutContainer;
    import com.extjs.gxt.ui.client.widget.Viewport;
    import com.extjs.gxt.ui.client.widget.button.Button;
    import com.extjs.gxt.ui.client.widget.form.ComboBox;
    import com.extjs.gxt.ui.client.widget.layout.TableLayout;
    import com.google.gwt.core.client.EntryPoint;
    import com.google.gwt.user.client.ui.RootPanel;
    import com.google.gwt.user.client.ui.Widget;
    
    /**
     * Entry point classes define <code>onModuleLoad()</code>.
     */
    public class ComboboxMemoryleak implements EntryPoint {
        
        public static final int WIDGET_COUNT = 50;
        LayoutContainer container;
    
        public void onModuleLoad() {
            Viewport viewport = new Viewport();
            viewport.setEnableScroll(true);
    
            LayoutContainer buttonContainer = new LayoutContainer();
            container = new LayoutContainer();
            
            Button clearButton = new Button("clear",  new SelectionListener<ComponentEvent>() {
                public void componentSelected(ComponentEvent ce) {
                    container.removeAll();
                    container.layout();
                }
            });
            buttonContainer.add(clearButton);
            Button addBadButton = new Button("add widgets with memory leak",  new SelectionListener<ComponentEvent>() {
                public void componentSelected(ComponentEvent ce) {
                    long start = System.currentTimeMillis();
                    for (int index = 0; index < WIDGET_COUNT; ++index) {
                        container.add(createWidgetMemLeak(index));
                    }
                    container.layout();
                }
            });
            buttonContainer.add(addBadButton);
    
            Button addGoodButton = new Button("add 'good' widgets",  new SelectionListener<ComponentEvent>() {
                public void componentSelected(ComponentEvent ce) {
                    for (int index = 0; index < WIDGET_COUNT; ++index) {
                        container.add(createWidgetNormal(index));
                    }
                    container.layout();
                }
            });
            buttonContainer.add(addGoodButton);
    
            container.setScrollMode(Scroll.AUTO);        
            container.setLayout(new TableLayout(5));
            viewport.add(buttonContainer);
            viewport.add(container);
            RootPanel.get().add(viewport);
    
        }
        
        /**
         * Creates and returns a widget without memory leak.
         */
        public Widget createWidgetNormal(int index) {
            return new Html("widget " + index);
        }
    
        /**
         * Creates and returns a widget that has a memory leak (memory in browser will not be freed
         * after removal of this widget).
         */
        public Widget createWidgetMemLeak(int index) {
            ComboBox<BaseModel> box = new ComboBox<BaseModel>();
            box.setId("id" + index);
            box.setEditable(false);
            ListStore<BaseModel> store = new ListStore<BaseModel>();
            for (int modelIndex = 0 ; modelIndex < 7; ++modelIndex) {
                BaseModel data = new BaseModel();
                data.set("id", modelIndex);
                data.set("index", modelIndex);
                data.set("label", "key" + modelIndex);
                data.set("value", "value" + modelIndex);
                store.add(data);
            }
            box.setStore(store);
            box.setDisplayField("label");
    
            return box;
        }
    }
    Versions used (server on linux, browser on windows)
    Browser: IE6, IE7, Firefox 3 on windows XP
    GXT: 1.0.1 and 1.0.2
    GWT: 1.5-RC1 (linux)

  2. #2
    Ext GWT Premium Member gslender's Avatar
    Join Date
    Mar 2008
    Location
    Brisbane, Australia
    Posts
    1,572
    Vote Rating
    2
    gslender is on a distinguished road

      0  

    Default


    may not solve the problem, but GWT 1.5.1 (RC2) has some memory leak fixes that seems to work with GXT - limitted testing on my part.... give that a try and see if this changes the outcomes ???

  3. #3
    Ext User
    Join Date
    Jul 2008
    Posts
    9
    Vote Rating
    0
    cdaller is on a distinguished road

      0  

    Default


    thanks for the info, I'll give it a try...

  4. #4
    Ext User
    Join Date
    Jul 2008
    Posts
    9
    Vote Rating
    0
    cdaller is on a distinguished road

      0  

    Default


    No GWT-1.5.1 does not make any difference. Did some more tests with firefox, and it seems that firefox does not release any memory at all. Very strange!

    After some more tests:
    No difference between gwt-1.5.0-RC1 and gwt-1.5.1 (RC2): IE6 frees some memory (for Html widget), firefox does not free any memory (on Html or ComboBox widget).

    Please, could someone explain how to minimize memory consumption in browsers? What is wrong in "removeAll"?

    Thanks
    Christof

  5. #5
    Ext User
    Join Date
    Jul 2008
    Posts
    9
    Vote Rating
    0
    cdaller is on a distinguished road

      0  

    Exclamation can anyone confirm this behavior????

    can anyone confirm this behavior????


    Is there anybody out there to confirm this behavior? The browser's memory footprint grows and grows. This is a blocker for us!

    We did some more experiments with firefox (linux, windows), IE6 on windows XP.

    We tried to build more or less the same example with pure gwt (no gxt): Windows Taskmanager shows that the memory does not grow (when adding/removing gwt widgets), while drip (ieleak) shows a steady increase of memory.

    Firefox (windows XP (measured with Taskmanager) and linux) does not return any memory at all.

    I really cannot believe that gwt and/or gxt just consumes memory and never returns it again! Is this a browser problem, a measurement problem?

    We were close to buy some gxt licenses, but this problem needs to be solved first.

  6. #6
    Sencha - GXT Dev Team darrellmeyer's Avatar
    Join Date
    May 2007
    Location
    Washington, DC
    Posts
    2,241
    Vote Rating
    2
    darrellmeyer is on a distinguished road

      0  

    Default


    The issue is confirmed and the fix will go in the next release.

  7. #7
    Ext User
    Join Date
    Jul 2008
    Posts
    9
    Vote Rating
    0
    cdaller is on a distinguished road

      0  

    Default


    Quote Originally Posted by darrellmeyer View Post
    The issue is confirmed and the fix will go in the next release.
    Cool! When will be the next release?

    Thanks
    Christof

  8. #8
    Sencha - GXT Dev Team darrellmeyer's Avatar
    Join Date
    May 2007
    Location
    Washington, DC
    Posts
    2,241
    Vote Rating
    2
    darrellmeyer is on a distinguished road

      0  

    Default


    1.0.3 will go in a day or two.

  9. #9
    Sencha - GXT Dev Team darrellmeyer's Avatar
    Join Date
    May 2007
    Location
    Washington, DC
    Posts
    2,241
    Vote Rating
    2
    darrellmeyer is on a distinguished road

      0  

    Default


    Fix is in SVN. Also, with the new code you can do combo.setLazyRender(true) and the drop down list will not be rendered until it is first displayed.

  10. #10
    Ext User
    Join Date
    Jul 2008
    Posts
    9
    Vote Rating
    0
    cdaller is on a distinguished road

      0  

    Default


    Quote Originally Posted by darrellmeyer View Post
    Fix is in SVN. Also, with the new code you can do combo.setLazyRender(true) and the drop down list will not be rendered until it is first displayed.
    sounds great! Looking forward to the new release!

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar