On Aug 18, 2010, at 4:44 AM, Brian Candler wrote:

> Chuck Remes wrote:
>> In the meantime, it looks like I need to save my Foo instances to an 
>> array or something similar if I want to make sure that they do NOT get 
>> collected until I'm ready.
> 
> In any case, if you don't keep a reference to them somewhere, then you 
> can never call any method on them, so the objects are obviously useless 
> (which is why they are garbage-collected in the first place)

Not necessarily true. The Bar class in my example could have its own internal lifecycle where it is generating events for Baz and Quxxo which in turn are reacting to or generating events for Bar. Plus, they all may be interacting with yet more objects on a local or remote system. Retaining a reference to the Bar instance from Foo does not preclude them from doing useful work.

cr