Hybrid View
-
22 Jul 2008 1:02 PM #1
Panel leak ?
Panel leak ?
Hi all,
in this code:
i create a panel and added 200 buttons. After remove the buttons, the memory on IE or FireFox don't returns to original memory.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(); }); });
This is a leak ? How i can resolve it ?
Thanks,
Daniel
-
22 Jul 2008 5:44 PM #2Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- Frederick MD, NYC, DC
- Posts
- 16,169
- Vote Rating
- 28
any time you add/remove dom elements, you'll see memory being added to the browser memory pool.

Jay Garcia @ModusJesus || Modus Create co-founder
Ext JS in Action author
Sencha Touch in Action author
Get in touch for Ext JS & Sencha Touch Touch Training
We are also working on Video-based Sencha Touch training: Check it out here.
-
23 Jul 2008 6:20 AM #3
-
23 Jul 2008 6:59 AM #4Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- Frederick MD, NYC, DC
- Posts
- 16,169
- Vote Rating
- 28
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.

Jay Garcia @ModusJesus || Modus Create co-founder
Ext JS in Action author
Sencha Touch in Action author
Get in touch for Ext JS & Sencha Touch Touch Training
We are also working on Video-based Sencha Touch training: Check it out here.
-
23 Jul 2008 1:37 PM #5
-
23 Jul 2008 2:26 PM #6
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.
-
23 Jul 2008 3:15 PM #7Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- Frederick MD, NYC, DC
- Posts
- 16,169
- Vote Rating
- 28

Jay Garcia @ModusJesus || Modus Create co-founder
Ext JS in Action author
Sencha Touch in Action author
Get in touch for Ext JS & Sencha Touch Touch Training
We are also working on Video-based Sencha Touch training: Check it out here.
-
23 Jul 2008 3:30 PM #8
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.
-
28 Jul 2008 12:03 PM #9
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!


Reply With Quote

