From: matz@... (Yukihiro Matsumoto) Date: 2001-06-27T10:40:57+09:00 Subject: [ruby-talk:16946] Re: Another question Hi, In message "[ruby-talk:16941] Another question" on 01/06/27, Will Sobel writes: |The question--can you define a finalizer on self in the initialize method as |they do in DBI or is this illegal? This one should be added to FAQ. |class Test | def initialize | ObjectSpace.define_finalizer(self, Proc.new{ puts "finalizing" }) | end |end The answer would be: Your registering finalizer (Proc object) contains the reference to the target object so that it would never be a garbage. You have to carefully remove the reference to the target, for example, class Test def Test.finalizer Proc.new{ puts "finalizing" } end def initialize ObjectSpace.define_finalizer(self, Test.finalizer) end end Could you add this one to the FAQ, Dave? matz.