E
Eric Mahurin
Does anybody else think it is a serious issue that a Proc holds
references to all variables (including self) where it was
created (through a block)? These references are held through
Proc#binding. Although this does add some useful capability on
occasion, this causes excess memory to be used (worst case
could be a leaky program). Is this worth it? Personally, I
think not. I'd propose that Proc#binding return something that
only have access to variables referenced in the Proc. Even the
self from the defining context would be prohibited if not
referenced (possibly implicitly) in the Proc. Another option
would be to make these references weak so that they won't
prevent GC and those references would disappear if the
referenced object (including the variables/variable-table) is
GCed.
Comments?
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around=20
http://mail.yahoo.com=20
references to all variables (including self) where it was
created (through a block)? These references are held through
Proc#binding. Although this does add some useful capability on
occasion, this causes excess memory to be used (worst case
could be a leaky program). Is this worth it? Personally, I
think not. I'd propose that Proc#binding return something that
only have access to variables referenced in the Proc. Even the
self from the defining context would be prohibited if not
referenced (possibly implicitly) in the Proc. Another option
would be to make these references weak so that they won't
prevent GC and those references would disappear if the
referenced object (including the variables/variable-table) is
GCed.
Comments?
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around=20
http://mail.yahoo.com=20