View Full Version : Question about the destory mechanism
14 Oct 2012, 12:27 AM
If I am creating some views and some of them are created new Ext.window or menus which are not part of the view items collection config.
Should I destory these menus and windows my self.
Such as on the beforedestroy on the view to call the destory method of the menu or window?
14 Oct 2012, 3:00 AM
In short, yes.
Component leaks are a common source of memory problems. Every component is registered with the ComponentManager at creation time so it cannot be garbage collected until it is destroyed. You can check whether you're leaking components by monitoring the ComponentManager:
When a container is destroyed it will automatically destroy its children too. Floating components like windows and menus are awkward here because they usually aren't children of a container.
For windows, you don't necessarily need to destroy them manually. When the window is closed it can either be destroyed or hidden depending on closeAction:
Menus are a more common source of leaks. When a menu disappears it is merely hidden. If you use a debugger to inspect the DOM elements you'll see the menu at the bottom of the body. If you reuse the same menu instance it'll leak less but you'll need to be careful to destroy it at the correct moment. If you create a new menu each time it's shown then you can just wire up a listener on the hide event to destroy it.
14 Oct 2012, 3:21 AM
Thank i will follow this guidline
I tried to call the detroy on my panel and registered to the beforedestroy event but when I called panel.destory the event wansnt called and nor did the panel was destoryed.
Powered by vBulletin® Version 4.2.3 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.