View Full Version : [OPEN][3.x] Floating Menu memory Leak - Ext.Shadows are never destroyed

9 Dec 2009, 5:51 AM

when clicking on the column menu, this create a menu and lots of DOM elements.
When hide this menu, and when i destroy the gridPanel, these DOM elements are still here.

Any idea ? I would prefer ask, because of my latest post was a memory leak bugfixed in the 3.1 version
So, if it's already bugfixed, i would prefer to know now.

Thanks for help

P.S : any idea for the 3.1 release date ?

9 Dec 2009, 7:01 AM
The menus themselves get destroyed, but the shadow elements are left behind.

9 Dec 2009, 7:05 AM
so ?
no fix available ? neither in 3.1 ?

9 Dec 2009, 7:13 AM
so? These shadow elements are reused throughougt the application where menus are reshown.

This is not a bug. You need to be clear on terms like "Memory leak". In my opinion, this is not a flaw and there is no memory leak present.

9 Dec 2009, 7:13 AM
Btw, I tested this in the pre-final 3.1 release.

9 Dec 2009, 8:46 AM
re-used ?
don't agree with u.
Be sure i do some tests (and some code reviews) before posting here
My test case is the following :
Show a grid, open the column menu, then destroy the grid : 23 DOM elements in sIEve
repeat twice : 46 elements in sIEve
repeat more : 69 elements ! and telling me re-used ? when ?
not releasing elements in my menu :
- 1 SPAN (x-menu-item-text) + 1 IMG (x-menu-item-icon) by Menu Item,
- some DIV and BUTTONS (pagingtoolbar) not released due to sus-mentioned memory leak

9 Dec 2009, 8:59 AM
I can't validate your test case because you're not providing enough information.

You can't just go around posting threads in the bug forum like http://www.extjs.com/forum/showthread.php?p=417003#post417003 and expect to get a valid response.

That said, please read the following thread: http://www.extjs.com/forum/showthread.php?t=71015 and post something that we can easily reproduce.

I tested in Firebug while viewing the DOM manipulation piece in the array grid example.

9 Dec 2009, 9:03 AM
The left over shadow elements are left for reuse for future menus to be displayed.

I do think that they should be destroyed when no more instances of Ext.menu.Menu exist.

9 Dec 2009, 9:05 AM
Okay guy...
So, i'll wait for the 3.1 release, expecting this problem will disappear, otherwise i'll post a complete testcase.

Thanks for your support


9 Dec 2009, 9:14 AM
Hmmm.. there does seem to be a bug actually.

floating Ext.menu.Menus (as is the case with gridpanel column menus) are actually just Ext.Layers with supporting Ext.Shadow instances.

when a floating menu (i.e. an Ext.Layer) is destroyed, the corresponding Ext.Shadow is hidden but never destroyed. Here's the code for Ext.Layer#destroy()

// private
destroy : function(){
delete this.dom;

note the portion in red.

i do see code for an Ext.Shadow.Pool, but it seems that the only times Shadows are retrieved / returned to the Pool are when they're hidden / shown. In the case of Ext.Layers, the Shadows are always created anew for every instance.

The code for Ext.Shadow / Ext.Shadow.Pool definitely needs to be looked at.

I'll mark this thread [UNKNOWN] for closer scrutiny.
Also renamed it for better visibility.

9 Dec 2009, 9:19 AM
Thanks mark.

I do see shadows reused by multiple menus.

9 Dec 2009, 9:22 AM
I do see shadows reused by multiple menus.

did you see this in one of the stock examples?

9 Dec 2009, 9:26 AM
yes, look at the grid example and add your own menu. the shadows are reused (at least in fx + fb)

9 Dec 2009, 9:37 AM
yes, i see the Shadow Elements being reused.
but the pool is never shrunk! (there's no upper limit to the pool size!!)

9 Dec 2009, 9:40 AM
I didn't go down to that level. great catch dude.