From: Brian Candler Date: 2008-11-09T17:09:30+09:00 Subject: Re: Memory implications for persistent Proc objects Farrel Lifson wrote: > big_object = BigObjectNeedsLotsOfRAM.new > my_proc = Proc.new { ... } # big_object not referenced in my_proc > big_object = nil > my_proc.call > > Will the memory allocated to big_object remain in use because it was > alive when my_proc was created despite it not being referenced or used > in my_proc? Clearly not, because big_object has been assigned to nil. That is: big_object may exist in the environment of my_proc, but it's the *same* big_object variable that you've assigned outside too. Now, if you had not assigned to big_object, but just let it drop out of scope, then I wouldn't be so sure. However you said explicitly that you're only interested in what happens at the top level, and you can't make things drop out of scope at that level. -- Posted via http://www.ruby-forum.com/.