From: Rick DeNatale Date: 2008-01-11T07:09:04+09:00 Subject: Re: why does this code leak? On 1/10/08, Robert Dober wrote: > As said above I would love to know a case where this is needed in > which case one shall probably file a bug report to Ruby 1.9. Imagine this code: class Foo def initialize creation_time = Time.now ObjectSpace.define_finalizer self, lambda{ puts "An Object has died (#{creation_time}-#(Time.now}) R.I.P." end end Here in the block puts really means self.puts, so the block needs to capture the binding of self, as well as the binding of the local creation_time. Now since the VM doesn't look inside the block when creating a proc, it has to assume that the binding of he context in which the block was created has to be captured. -- Rick DeNatale My blog on Ruby http://talklikeaduck.denhaven2.com/