Skip to content

Comment on A surprising JavaScript memory leak found at Meteor

Comments

You could imagine a more clever implementation of lexical environments that avoids this problem. Each closure could have a dictionary containing only the variables which it actually reads and writes; the values in that dictionary would themselves be mutable cells that could be shared among the lexical environments of multiple closures.

That is basically how Lua implements closures.

https://bugzilla.mozilla.org/show_bug.cgi?id=542074

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.