Results 1 to 4 of 4

Thread: Tree autoRefresh/reload memory leak?

  1. #1

    Default Tree autoRefresh/reload memory leak?

    Okay So i've been having a lot of issues over the past week or two with my tree panel, most of which were cleared up when moving to extjs 1.1 RC1, however I'm noticing a new problem so i thought i would start a new thread.

    I'm now noticing memory "leaks" or at least a continues increase in memory usage by firefox and opera when i reload the tree node. I've read that it could be due to event listeners or due to firebug or due to firefox page caching, but if that's the case most of this would stop if i used opera, or if i removed the event listeners or if i turned off firefox's caching ability. None of these seemed to fix the leak so it must be something in my code. if anyone has any idea how or why this is happening... i would love some help.

    Here's the code:

    PHP Code:

    // Create the tree panel
        
    var Tree Ext.tree;
        
    this.tree = new Tree.TreePanel('peers-panel', {
            
    animate:true
            
    loader: new Tree.TreeLoader({
                
    dataUrl:baseURL '/skystar.php?a=getPeers'
            
    }),
            
    enableDD:true,
            
    ddGroup 'TreeDD',
            
    ddAppendOnlytrue,
            
    rootVisible:false,
            
    containerScrolltrue
        
    });

        
    // set the root node
        
    this.root = new Tree.AsyncTreeNode({
            
    draggable:false,     
            
    expandedtrue,
            
    id:'root'
        
    });
        
    this.tree.setRootNode(this.root);
          
        
    // render the tree
        
    this.tree.render();


        
    this.tree.on({
            
    contextmenu: {
                 
    scopethis,
                 
    fn:this.onContextClick
            
    },
            
    dblclick: {
                
    scopethis,
                
    fnthis.onDoubleClick
            
    },
            
    beforenodedrop: {
                
    scopethis,
                
    fnthis.onNodeDrop
            
    }
        });


        
    // Extens tree with auto Refresh
        
    Ext.override(Ext.tree.AsyncTreeNode, {
            
    startAutoRefresh : function(intervalrefreshNow){
                if(
    refreshNow){
                    
    this.reload();
                }
                if(
    this.autoRefreshProcId){
                    
    clearInterval(this.autoRefreshProcId);
                }
                
    this.autoRefreshProcId setInterval(this.reload.createDelegate(this), interval*1000);
            },
            
    stopAutoRefresh : function(){
                if(
    this.autoRefreshProcId){
                    
    clearInterval(this.autoRefreshProcId);
                }
            }   
        });
        
    this.root.startAutoRefresh(10); 
    the leaks seem to stop when you comment out the line this.root.startAutoRefresh(10). So i'm not even sure if it's my code or something in extjs that's causing this.

    My Json looks like

    Code:
    ([{"id":"mteam","text":"MTeam","expanded":true,"children":[{"id":"6066","text":"Erin Schieffer","leaf":"true","status":"0","paused":null,"email":"[email protected]","queue":null,"department":"mteam","icon":"images\/agent-Available.png","cls":"","qtip":"<div>Available<br><br>[email protected]<\/div>"},{"id":"6006","text":"Larry Selensky","leaf":"true","status":"4","paused":null,"email":"[email protected]","queue":null,"department":"mteam","icon":"images\/agent-Unavailable.png","cls":"","qtip":"<div>Unavailable<br><br>[email protected]<\/div>"},{"id":"6002","text":"John Schnipkoweit","leaf":"true","status":"0","paused":null,"email":"[email protected]","queue":null,"department":"mteam","icon":"images\/agent-Available.png","cls":"","qtip":"<div>Available<br><br>[email protected]<\/div>"}],"leaf":false},{"id":"eng","text":"Engineering","expanded":true,"children":[{"id":"6023","text":"Jason Garrett","leaf":"true","status":"0","paused":null,"email":"[email protected]","queue":null,"department":"eng","icon":"images\/agent-Available.png","cls":"","qtip":"<div>Available<br><br>[email protected]<\/div>"},{"id":"6058","text":"Courtney Wenman","leaf":"true","status":"4","paused":null,"email":"[email protected]","queue":null,"department":"eng","icon":"images\/agent-Unavailable.png","cls":"","qtip":"<div>Unavailable<br><br>[email protected]<\/div>"},{"id":"6005","text":"Nick Ruden","leaf":"true","status":"4","paused":null,"email":"[email protected]","queue":null,"department":"eng","icon":"images\/agent-Unavailable.png","cls":"","qtip":"<div>Unavailable<br><br>[email protected]<\/div>"}],"leaf":false},{"id":"1338","text":"QOR","expanded":true,"children":[{"id":"6101","text":"Andrew Sanner","leaf":"true","status":"0","paused":null,"email":"[email protected]","queue":null,"department":"qor","icon":"images\/agent-Available.png","cls":"","qtip":"<div>Available<br><br>[email protected]<\/div>"},{"id":"6107","text":"Michael Wood","leaf":"true","status":"2","paused":"0","email":"[email protected]","queue":"Support","department":"qor","icon":"images\/agent-Busy.png","cls":"agent","qtip":"<div>Busy<br>Support<br>[email protected]<\/div>"},{"id":"6018","text":"Justin Garrett","leaf":"true","status":"4","paused":null,"email":"[email protected]","queue":null,"department":"qor","icon":"images\/agent-Unavailable.png","cls":"","qtip":"<div>Unavailable<br><br>[email protected]<\/div>"}],"leaf":false},{"id":"1338","text":"CAIS","expanded":true,"children":[{"id":"6133","text":"Jacob Starks","leaf":"true","status":"4","paused":null,"email":"[email protected]","queue":null,"department":"cais","icon":"images\/agent-Unavailable.png","cls":"","qtip":"<div>Unavailable<br><br>[email protected]<\/div>"},{"id":"6116","text":"Aaron Eichler","leaf":"true","status":3,"paused":"1","email":"aeichler[email protected]","queue":"Support","department":"cais","icon":"images\/agent-Paused.png","cls":"agent","qtip":"<div>Paused<br>Support<br>[email protected]<\/div>"},{"id":"6123","text":"Lane Gutz","leaf":"true","status":"4","paused":null,"email":"[email protected]","queue":null,"department":"cais","icon":"images\/agent-Unavailable.png","cls":"","qtip":"<div>Unavailable<br><br>[email protected]<\/div>"},{"id":"6106","text":"Steven Smith","leaf":"true","status":"4","paused":null,"email":"[email protected]","queue":null,"department":"cais","icon":"images\/agent-Unavailable.png","cls":"","qtip":"<div>Unavailable<br><br>[email protected]<\/div>"},{"id":"6134","text":"Derek Schmidt","leaf":"true","status":"4","paused":null,"email":"[email protected]","queue":null,"department":"cais","icon":"images\/agent-Unavailable.png","cls":"","qtip":"<div>Unavailable<br><br>[email protected]<\/div>"},{"id":"6114","text":"Anthony Mueller","leaf":"true","status":"2","paused":"0","email":"[email protected]","queue":"Support","department":"cais","icon":"images\/agent-Busy.png","cls":"agent","qtip":"<div>Busy<br>Support<br>[email protected]<\/div>"}],"leaf":false},{"id":"sales","text":"Sales","expanded":true,"children":null,"leaf":true}])

  2. #2

    Default

    This same thing seems to happen when you remove the autoRefresh and the event listeners on the tree, and just use a button press to call this.root.reload();

    each time it reloads it seems to take 200-300kb... This could be cache like mentioned in a few other posts but if this were the case then would it continue until your system's memory is used up completely? I've also removed all event listeners and tested it and nothing seems to change...

    The only place left is in the Extjs code itself (that i can think of)

    but the reload command is fairly simple:
    PHP Code:
        /**
         * Trigger a reload for this node
         * @param {Function} callback
         */
        
    reload : function(callback){
            
    this.collapse(falsefalse);
            while(
    this.firstChild){
                
    this.removeChild(this.firstChild);
            }
            
    this.childrenRendered false;
            
    this.loaded false;
            if(
    this.isHiddenRoot()){
                
    this.expanded false;
            }
            
    this.expand(falsefalsecallback);
        } 
    Could it be possible that the Json array isn't being destroyed after being consumed by the tree? or on reload? I'm really clueless here as to what's happening. just a lot of question. I'm stripping everything else out of my web app and just doing a plain tree w/ json data loaded from treeloader and i'll attempt to see if it's still increasing in size.

    If i find anything else i'll report here... (not sure if anyone else is even interested though )

  3. #3
    Sencha User
    Join Date
    Mar 2007
    Posts
    7,854

    Default

    Which adapter are you using? In this thread, Jack reports fixing a memory leak in ext-base that will be in RC2.

  4. #4

    Default

    i'm using Extjs-1.1-RC1 with YUI adapter and the yui-utilities.js ...

    I forgot about changing my base adapter once upgrading from one of the older ext libs... i'll try out ext-base.js instead of the yui and see if that helps...


    UPDATE:
    After a quick test it doesn't seem to fix the problem... but like you said i'm still using RC1 so maybe RC2 has the fix... to bad i dont have SVN access

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •