No, setting EggCarton = Nil will do nothing.  The way it works, RB
keeps a reference count of every object.  When the ref count = 0, the
object is destroyed.  EggCarton = Nil will decrement the ref count,
but it will never go to 0 because of the Eggs still hold a reference
to the carton.  Thus no destroyer is ever called, and you have a
memory leak with unreachable objects stuck in memory.  That's why your
carton needs a method that you call manually, that will itself call a
method on each egg to release it's reference to the parent.  Or you
could use WeakRefs.

Math

On 4/11/07, Stephen Dodd <[EMAIL PROTECTED]> wrote:
> If I set EggCarton = nil, won't that kill the EggCarton and the last
> references to the Eggs thereby eventually garbaging the Eggs. Thus no
> need for a child.cleanup.  Does Nil take care of this problem?
>
_______________________________________________
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