From: "Florian G. Pflug" Date: 2001-08-14T13:38:05+09:00 Subject: [ruby-talk:19672] Re: Forced garbage collection On Mon, Aug 13, 2001 at 12:34:09PM +0900, jweirich@one.net wrote: > Florian> Well.. but on the other hand, why isn't the block > Florian> collected, and then the object? Because the block is > Florian> needed, when the object is destructed. This seems to be a > Florian> kind of "circular dependency" - or in other words a > Florian> deadlock. > > The block is referenced by the ObjectSpace data structures (whatever > they are) that tracks finalizers. This prevents the block from being > GC'ed. The block references the object, so the object can't be GC'ed > either. The object has no reference back to the block (AFAIK), so > there are no cycles in the object graph. I saw "block is references by the ObjectSpace data structures, to be called when object is dead" as similar to "object has reference to block" - just as an explaination for why I said "deadlock" - but I can easily be than this defines "has reference to" to widely. Howevery, would it be easy to print a warning when this happens? I needed quite I while to figure out why my finalizer was not called, and it seems as I was not the only one bitten by this. greetings, Florian Pflug