On 11/30/05, Peter C. Verhage <peter / no-nonsense.org> wrote: > Hi, > > How about making self a WeakRef in the finalize method? > http://www.ruby-doc.org/stdlib/libdoc/weakref/rdoc/ Or just say in the docs that any references to self will become invalid after finalize is called. I don't think doing this is any less safe than using #object_id and ObjectSapce::_id2ref (same type of error if you use this on an object_id already GCed). Right now if you are using ObjectSapce::define_finalizer, you are likely using ObjectSpace::_id2ref somewhere (you probably have some data-structure holding object_id's). Maybe this method could be called #_finalize to say that it isn't safe (like ObjectSpace::_id2ref).