Farrel Lifson
11/8/2008 10:10:00 PM
What are the memory implications for keeping a Proc/closure around
especially those that are defined in a global scope? Is Ruby clever
enough not to keep objects in the Proc closure that are never
referenced in that closure? I'm worried where I have the following
scenario
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?
Farrel