>Are circular references never destroyed and garbage collected?

Usually/Sometimes.  Can you afford to rely on this?

>
>In Aaron's nice little intro to 2007r2
>(http://www.rblibrary.com/rblibrary/index.php?main_page=product_info&products_id=81),
>he mentions the dangers of circular references stopping objects from
>being destroyed (and the use of WeakRef to get around it.)
>
>Let's look at an example:
>
>EggCarton object contains 12 Egg objects (as properties)
>Each Egg contains a reference to the parent EggCarton
>
>If my program creates and destroys EggCartons containing Eggs, will I
>'leak' memory unless I use WeakRef?  (Assume only the EggCarton
>references Eggs.)


Each child needs to clean up it's link to the parent.
Just call your own child.cleanup when closing the parent (ie in the 
_parent's_ destructor)

>
>
>Will the Easter Bunny be mad at my Egg Factory?

Never!  Unfertilized eggs are always always welcome.....
-- 

Cheers,

Dr Gerard Hammond
MacSOS Solutions
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to