From: nobu@... Date: 2006-05-20T01:50:30+09:00 Subject: Re: Question on GC Hi, At Fri, 19 May 2006 22:58:28 +0900, Madan Manoharan wrote in [ruby-talk:193553]: > def getATest() > procObj = Proc.new do |id| > @store.delete(id) > end > > t = Test.new() > @store.push(t.__id__) > > ObjectSpace.define_finalizer(t, procObj) > return t.__id__ > end Note that procObj also refers t, so this object will never get collected. procObj = @store.method(:delete).to_proc is an alternative. -- Nobu Nakada