1. #1
    Ext User Daniel Schmitz's Avatar
    Join Date
    Dec 2007
    Posts
    60
    Vote Rating
    0
    Daniel Schmitz is on a distinguished road

      0  

    Default Panel leak ?

    Panel leak ?


    Hi all,

    in this code:

    Code:
    Ext.onReady(function(){
        
    	 var btnAdd = new Ext.Button({
            text: 'Add 200 fields'
        });
    	
    	 var btnRemove = new Ext.Button({
            text: 'Remove all fields'
        });
    	
    	var p = new Ext.Panel({
            title: 'My Leak Panel',
            collapsible:true,
    		collapsed: false,
    		tbar: [btnAdd,btnRemove],
            width:400,
    		height:300,
    		renderTo: Ext.getBody()
    
    		
        });
    	
    	btnAdd.on("click",function(s,e){
    		for (var i=0;i<200;i++)
    		{
    			var btn = new Ext.Button({text: 'Button'});
    			p.add(btn);
    		}
    		p.doLayout();
    	});
    	
    	btnRemove.on("click",function(s,e){
    		var count = p.items.length
    		for (var i=0;i<count;i++)
    		{
    			p.remove(0,true);
    		}
    		p.doLayout();
    	});
    	
    });
    i create a panel and added 200 buttons. After remove the buttons, the memory on IE or FireFox don't returns to original memory.

    This is a leak ? How i can resolve it ?

    Thanks,
    Daniel

  2. #2
    jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    Frederick MD, NYC, DC
    Posts
    16,360
    Vote Rating
    81
    jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all

      0  

    Default


    any time you add/remove dom elements, you'll see memory being added to the browser memory pool.

  3. #3
    Ext User Daniel Schmitz's Avatar
    Join Date
    Dec 2007
    Posts
    60
    Vote Rating
    0
    Daniel Schmitz is on a distinguished road

      0  

    Default


    Hi

    this is a EXT leak or browser leak ??

  4. #4
    jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    Frederick MD, NYC, DC
    Posts
    16,360
    Vote Rating
    81
    jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all

      0  

    Default


    it's just the way things are. People use the term LEAK way too much, thinking that they know what's going on under the hood. I certainly don't. I do know that even browsing the web causes memory utilization to go up, even after closing tabs.

  5. #5
    Ext User Daniel Schmitz's Avatar
    Join Date
    Dec 2007
    Posts
    60
    Vote Rating
    0
    Daniel Schmitz is on a distinguished road

      0  

    Default


    ok... is a leak ..............

  6. #6
    Ext User
    Join Date
    Jul 2007
    Posts
    3,128
    Vote Rating
    1
    devnull is an unknown quantity at this point

      0  

    Default


    It could very well just be memory being allocated to the browser for use as cache. As time goes on, cache items will expire and memory usage will likely go down.

  7. #7
    jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    Frederick MD, NYC, DC
    Posts
    16,360
    Vote Rating
    81
    jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all

      0  

    Default


    Quote Originally Posted by Daniel Schmitz View Post
    ok... is a leak ..............


    i would say no.

  8. #8
    Ext User
    Join Date
    Jul 2008
    Posts
    11
    Vote Rating
    0
    jeromewilson is on a distinguished road

      0  

    Default


    How are you removing the buttons? Are you using Ext.destroy() ?

    destroy( Mixed arg1, [Mixed arg2], [Mixed etc...] ) : void
    Attempts to destroy any objects passed to it by removing all event listeners, removing them from the DOM (if applicable) and calling their destroy functions (if available). This method is primarily intended for arguments of type Ext.Element and Ext.Component, but any subclass of Ext.util.Observable can be passed in. Any number of elements and/or components can be passed into this function in a single call as separate arguments.

  9. #9
    Ext User Daniel Schmitz's Avatar
    Join Date
    Dec 2007
    Posts
    60
    Vote Rating
    0
    Daniel Schmitz is on a distinguished road

      0  

    Default


    Hi jeromewilson,

    i try the destroy method, but without success

    Code:
    btnRemove.on("click",function(s,e){
    		var count = p.items.length;
    		for (var i=0;i<count;i++)
    		{
    			var item = p.items[0];
    			p.remove(0,true);
    			Ext.destroy(item);
    		}
    		p.doLayout();
    
    	});

    Garcia... like a yoda say.... very funny you are... but EXISTs LEAK!

    devnull: The memory don't go down with a time. See the Graphic to explanation.

    thanks all!
    Attached Images