From: Robert Klemme Date: 2003-12-09T20:02:01+09:00 Subject: Re: WeakRef and Object#hash "ts" schrieb im Newsbeitrag news:200312091017.hB9AHYH22207@moulon.inra.fr... > >>>>> "R" == Robert Klemme writes: > > R> What can we do about this in Ruby if we want the instance to be GC'ed? Is > R> there a workaround at least for testing purposes? > > Like has said matz, nothing. > > But there is something worst, be carefull with weakref : the example was > given in ruby-core. Someone created weakrefs and stored the ID of the > reference in a hash and when he wanted to retrieve the object he called > _id2ref. His algorithm was : > * _id2ref raise an error ==> this mean that the object was recycled > * otherwise it retrieve the original object. Clearly a bad idea. robert