From: David Masover Date: 2008-09-20T10:31:35+09:00 Subject: Re: Garbage collecting threads? On Friday 19 September 2008 05:31:07 Brian Candler wrote: > If the farmer and the workers form an isolated subgraph of objects - > e.g. there are no other references to them from the stack or from global > variables or from other objects - then they will all be garbage > collected together. Unless the worker includes a running Thread. Since Ruby does not solve the Halting Problem, it can't predict what that Thread will do, and thus, can't discard anything still referenced by the thread. Now, once I've stopped the thread, it should be able to discard all of it. But I need it to collect the farmer to trigger my finalizer, and I need the finalizer to cleanup the threads. And there is, indirectly, a reference, by way of a queue. But I suppose the queue won't refer back to the farmer, so that should work well.