1. #1
    Ext User
    Join Date
    Jul 2007
    Location
    Porto, Portugal
    Posts
    32
    Vote Rating
    0
    filipe_c is on a distinguished road

      0  

    Default [1.1.1] grid mem leak with iexplorer (urgent...)

    [1.1.1] grid mem leak with iexplorer (urgent...)


    OS :Windows XP, SP2
    Browser : Iexplorer 6.0 (at least, i did not test 7.0)
    Mem leak program: Drip
    Code:
    // Store definition
    var ds 	= new Ext.data.Store({
    		        reader: new Ext.data.ArrayReader({id:0}, [
    					{name: 'scatag'		},
    					{name: 'pri'	}
                      ])
    });
    
    // grid definition
    var colModelAlr = new Ext.grid.ColumnModel([
    {id:'scatag'	, header: lang['Tag'],		width: 60, dataIndex: 'scatag',			sortable: true,hidden:true },
    {id:'pri'		, header: lang['pri'],		width: 40, dataIndex: 'pri',			sortable: true,hidden:false }
    ]);
    
    grid = new Ext.grid.Grid('alarms-grid', {
                ds: ds,
                cm: colModelAlr,
    	selModel: new Ext.grid.RowSelectionModel(),
            enableColLock:false,
    	loadMask: true,
               enableDrag: true
       });
    
    grid.render();
    now i
    Attached Images
    Last edited by mystix; 2 Oct 2007 at 7:08 AM. Reason: use [code][/code] tags

  2. #2
    Ext User
    Join Date
    Jul 2007
    Location
    Porto, Portugal
    Posts
    32
    Vote Rating
    0
    filipe_c is on a distinguished road

      0  

    Default


    a strange thing is that if i comment the code
    bt.firstChild.removeChild(bt.rows[index]);
    on gridview the leak is much less... 1268 nodes...
    what the hell ...


    Code:
    the final number of nodes is 
    
        onRemove : function(ds, record, index, isUpdate){
            if(isUpdate !== true){
                this.fireEvent("beforerowremoved", this, index, record);
            }
            var bt = this.getBodyTable(), lt = this.getLockedTable();
            if(bt.rows[index]){
    //			bt.firstChild.removeChild(bt.rows[index]);
            }
            if(lt.rows[index]){
                lt.firstChild.removeChild(lt.rows[index]);
            }
            if(isUpdate !== true){
                this.stripeRows(index);
                this.syncRowHeights(index, index);
                this.layout();
                this.fireEvent("rowremoved", this, index, record);
            }
        },
    Last edited by mystix; 2 Oct 2007 at 7:08 AM. Reason: use [code][/code] tags

  3. #3
    Ext User
    Join Date
    Jul 2007
    Location
    Porto, Portugal
    Posts
    32
    Vote Rating
    0
    filipe_c is on a distinguished road

      0  

    Default


    here is the dom usage in drip...
    it seems that each row is an <tr><td>...

    but the
    bt.firstChild.removeChild(bt.rows[index]);

    does not delete the dom nodes of this tr...

    look to drip...
    Attached Images

  4. #4
    Ext User
    Join Date
    Jul 2007
    Location
    Porto, Portugal
    Posts
    32
    Vote Rating
    0
    filipe_c is on a distinguished road

      0  

    Default


    I discover the source of the problem...
    removeChild in iexplorer does not work... it apeears that it keeps a reference and gc does not collect that object.

    this is a probleme since extjs uses a lot removeChild...

    check http://www.outofhanwell.com/ieleak/i...e=Fixing_Leaks
    this guy show a discard element technique...
    Code:
    function discardElement(element) {
        var garbageBin = document.getElementById('IELeakGarbageBin');
        if (!garbageBin) {
            garbageBin = document.createElement('DIV');
            garbageBin.id = 'IELeakGarbageBin';
            garbageBin.style.display = 'none';
            document.body.appendChild(garbageBin);
        }
    
        // move the element to the garbage bin
        garbageBin.appendChild(element);
        garbageBin.innerHTML = '';
    }
    Last edited by mystix; 2 Oct 2007 at 7:09 AM. Reason: use [code][/code] tags

  5. #5
    Ext User
    Join Date
    Jul 2007
    Location
    Porto, Portugal
    Posts
    32
    Vote Rating
    0
    filipe_c is on a distinguished road

      0  

    Default FIX: suggest update to extjs

    FIX: suggest update to extjs


    suggest to fix leak...
    tested in explorer 6.0

    from http://www.outofhanwell.com/ieleak/i...e=Fixing_Leaks
    Code:
    Ext.discardElement = function (element) {
    	var garbageBin = document.getElementById('IELeakGarbageBin');
        if (!garbageBin) {
    		garbageBin = document.createElement('DIV');
            garbageBin.id = 'IELeakGarbageBin';
            garbageBin.style.display = 'none';
            document.body.appendChild(garbageBin);
    	}
    
        // move the element to the garbage bin
        garbageBin.appendChild(element);
        garbageBin.innerHTML = '';
    }
    Ext.removeNode = function (node) {
    	if( Ext.isIE ){ 
    		Ext.discardElement(node);
    	}
    	else if(node && node.parentNode){
    		return node.parentNode.removeChild(node);
    	}
    }
    Ext.deleteAllChildNodes = function (node) {
           var count = node.childNodes.length;
           while(node.hasChildNodes()) { 
    			Ext.removeNode(node.firstChild); 
    	   }
           return count;
    }
    
    
      onRemove : function(ds, record, index, isUpdate){
            if(isUpdate !== true){
                this.fireEvent("beforerowremoved", this, index, record);
            }
            var bt = this.getBodyTable(), lt = this.getLockedTable();
    		//debugger ;
            if(bt.rows[index]){
    			Ext.deleteAllChildNodes(bt.rows[index]);
    			//bt.firstChild.removeChild(bt.rows[index]);
            }
            if(lt.rows[index]){
    			Ext.deleteAllChildNodes(lt.rows[index]);
                //lt.firstChild.removeChild(lt.rows[index]);
            }
            if(isUpdate !== true){
                this.stripeRows(index);
                this.syncRowHeights(index, index);
                this.layout();
                this.fireEvent("rowremoved", this, index, record);
            }
        },
    The problem is that this should be updated in all removeChild ...
    that a lot in ext
    Last edited by mystix; 2 Oct 2007 at 7:54 AM. Reason: dude, start learning how to use [code][/code] tags!

  6. #6
    Sencha - Community Support Team jsakalos's Avatar
    Join Date
    Apr 2007
    Location
    Slovakia
    Posts
    27,538
    Vote Rating
    380
    jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future

      0  

    Default


    I'm notifying Jack to take a look at this.
    Jozef Sakalos, aka Saki

    Education, extensions and services for developers at new http://extjs.eu
    News: Grid Search Plugin, ExtJS 5 Complex Data Binding using MVVM


  7. #7
    Ext User
    Join Date
    Jul 2007
    Location
    Porto, Portugal
    Posts
    32
    Vote Rating
    0
    filipe_c is on a distinguished road

      0  

    Default


    Quote Originally Posted by jsakalos View Post
    I'm notifying Jack to take a look at this.
    thanks, because i think it

  8. #8
    Ext User
    Join Date
    Jul 2007
    Location
    Porto, Portugal
    Posts
    32
    Vote Rating
    0
    filipe_c is on a distinguished road

      0  

    Default


    Quote Originally Posted by jsakalos View Post
    I'm notifying Jack to take a look at this.

    NO news ?

  9. #9
    Ext User
    Join Date
    Jul 2007
    Location
    Porto, Portugal
    Posts
    32
    Vote Rating
    0
    filipe_c is on a distinguished road

      0  

    Default


    No news about this,,,
    i think this is really important...

  10. #10
    Sencha - Community Support Team jsakalos's Avatar
    Join Date
    Apr 2007
    Location
    Slovakia
    Posts
    27,538
    Vote Rating
    380
    jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future

      0  

    Default


    A grid leak has already been added to the bug list of Ext 2.0. I cannot say now how and when fixes will be backported to 1.1.1.
    Jozef Sakalos, aka Saki

    Education, extensions and services for developers at new http://extjs.eu
    News: Grid Search Plugin, ExtJS 5 Complex Data Binding using MVVM


Thread Participants: 1