PDA

View Full Version : [Ext-1.1] TreePanel root node reload problem



0xception
5 Aug 2007, 5:55 PM
Okay I've posted a few times about this problem, assuming that it was an issue with my code i stripped everything i could possibly strip out. Then after testing i still have the problem, Then i was told it was an issue in ext-1.1 rc1 that would be fixed in rc2 (I'm assuming the final release of 1.1 fixed this) but I'm still having problems...

The problem is either a memory leak, pseudo-memory leak, or cache or something else. I'm not really sure but what ever it is, its a problem, as it continues to consume memory until my system crashes.

here's the code:


Ext.onReady(function(){
// Create the tree panel
var Tree = Ext.tree;
var tree = new Tree.TreePanel('peers-panel', {
loader: new Tree.TreeLoader(),
rootVisible:false,
lines:true
});

// set the root node
var root = new Tree.AsyncTreeNode({
expanded: true,
loader:new Ext.tree.TreeLoader({
dataUrl: baseURL + '/skystar.php?a=getPeers',
clearOnLoad: true
})
});
tree.setRootNode(root);

// render the tree
tree.render();

// Start a task to refresh root node every 5 sec
Ext.TaskMgr.start({
run: function () {
root.reload();
},
scope:this,
interval:5000
});
});


Here's a typical JSON response:

[{"id":"*15","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":"*13","text":"Engineering","expanded":true,"children":[{"id":"6023","text":"Jason Garrett","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":"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":"*12","text":"QOR","expanded":true,"children":[{"id":"6101","text":"Andrew Sanner","leaf":"true","status":"8","paused":null,"email":"[email protected]","queue":null,"department":"qor","icon":"images\/agent-Ringing.png","cls":"","qtip":"<div>Ringing<br><br>[email protected]<\/div>"},{"id":"6107","text":"Michael Wood","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>"},{"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":"*11","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":"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":"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":"*14","text":"Sales","expanded":true,"children":"","leaf":true}]

Here's a link to a working example : http://team.ovationnetworks.com/dev/Skystar/test.php

This is as simple of an example as i can think of and yet I'm not sure if I'm the cause or if it's something in ext or if it's something wrong with firefox, opera, and IE... All 3 browsers seem to grow in size until they crash, at least on all of my computers, some with and some without firebug and other extensions, and even on other co-workers PC's (windows based) that have IE and firefox with no extensions or add-ons.

I would really appreciate it if someone could test this page/code and see if they too see "leaks" or if anyone sees a problem with what I'm doing. and if so point out my stupidity.

here's some top output of the firefox process over the span a very small amount of time, but it continues to grow at the exact same rate.



VIRT RES SHR % TIME
260m 101m 31m 10.0% 6:10pm
274m 116m 31m 11.5% 6:15pm
318m 159m 31m 15.8% 6:25pm

evant
5 Aug 2007, 5:59 PM
As far as I'm aware the Ext tree isn't as thorough in cleaning up memory as some of the other components. You could try overriding them yourself and see if you get better performance.

0xception
6 Aug 2007, 11:30 AM
So maybe then this topic should be moved to the bug forum.

So I searched the forums for a while and found several different examples of ways to "clean", destroy, or reload trees. but have a few questions, would it be better to destroy the entire tree or just the root node and it's children? or just the root nodes children, and then just call load on the root node again?

Also i've seen several posts about removing listeners, do you need to just purge all listeners on the main tree objects, or the root node, or all nodes in the tree? does it matter or make a difference?

I just found http://extjs.com/forum/showthread.php?t=8616&highlight=destroy+tree this post by evant, which i'll be giving a try here shortly, at if not steal some of this code to try and make my own. but i really think the TreePanel ought to do this properly on node reloads so this is probably a bug.

(if not i'm sure i'll get scolded by an Extjs dev :) )

ssapq
20 Sep 2007, 2:32 PM
I've posted about this here:
http://extjs.com/forum/showthread.php?t=13357