From: Brian Candler Date: 2008-09-19T19:31:07+09:00 Subject: Re: Garbage collecting threads? >> Looking at your example, your workers still have references to your >> queue and >> to the farmer, which means the farmer will never be collected. > > I don't think you understand. If A holds a reference to B, then that > may(*) prevent B from being garbage-collected, but it definitely doesn't > prevent A from being garbage-collected. Sorry I didn't read your post exactly - I overlooked that you wanted the workers to contain a reference to the farmer. But even then the conclusion is still correct. 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. -- Posted via http://www.ruby-forum.com/.