Hi Everyone,

We have a rapidly growing qooxdoo based project so we started 
experiencing memory issues with it. Most of my questions can be answered 
with the help of debugger. Please don't think I'm too lazy to do it. I'm 
expecting Yes/No answers with some explanations if there is a need. 
Thanks in advance.

What are best practices at disposing qooxdoo-objects in the following 
scenarios?

1. Best place to dispose objects programmatically is the destructor. Is 
that right?

2. Are destructors inherently virtual? I've never seen a destructor that 
calls a base class destructor. Does qooxdoo call base class destructors?

2. References to other objects stored in properties.  Does qooxdoo 
nullify the properties at disposal?

3. Extra care should be taken not to dispose the same object more than 
once. Programmer should keep an eye on references. References can be 
created directly and indirectly. Direct references are member variables. 
Indirect references are managed by containers such as Composite, etc. 
Another case of indirect reference is a parent-child relationship inside 
complex widgets, I mean "createChildControlImpl".

3.1. Does a call to dispose automatically remove the reference from the 
parent container (e.g. Composite)?  So if I have both member variable 
and a Composite with an object I want to dispose, I will dispose it via 
member variable. At least I expect that the container will automatically 
lose another reference. The opposite way has a chance of a redundant 
dispose call.

4. References to other objects stored as member variables.  I think that 
this case is completely up to the programmer. He/she should explicitly 
dispose objects and then nullify the references. qx.util.DisposeUtil may 
become handy at that. Instead of disposing a group of objects one by 
one, one may call qx.util.DisposeUtil.disposeObjects(this, 
["foo","bar","etc"]) to dispose them all at once.  It's not that simple 
however. This method does not fully dispose containers such as 
Composite, etc. If you are disposing containers then there is a risk of 
losing references of their children and thus never being able to dispose 
them.

4.1. If you want to dispose containers along with their children you can 
use destroyContainer from qx.util.DisposeUtil.

5. Indirect references to widgets created via "createChildControlImpl". 
Should I ever dispose them manually? These widgets may easily be 
Composites with their own children collections. So I definitely should 
dispose such collections (#4.1).

6. Listeners. Does qooxdoo automatically nullify references to event 
listeners when their event source gets disposed?

PS I'm not sure but maybe I'm too eager at disposing

Thanks

Dmitry Pryadkin

------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to