Re:A surprising JavaScript memory leak found at Meteor
by DanWaterworth on Friday June 28, 2013 @03:43PM
(#5959960)
> You're right that a closure only needs to contain the variables that are closed over.
You would think so, but this assumption fails in the presence of eval.
"I just always assumed that all the variables present in a closure are maintained" should really be (something like) "I just always assumed that all the variables present in a scope that produced a closure are maintained". You're right that a closure only needs to contain the variables that are closed over, and that some of those variables are scoped such that they can appear in multiple closures.