Skip to content

Comment on A surprising JavaScript memory leak found at Meteor

Comments

I don't know how you can safely declare what's used vs unused in a language where properties can be dynamically accessed.

It's easy to check for dict.someProperty, but dict[propertyName] where propertyName can be the string "someProperty" is a much more complicated problem. Now you have to build a tree of everything that changes propertyName and make sure you know it can never be "someProperty".

You can't dynamically access scope objects in standard javascript[0] except by using `eval`, and `eval` already triggers special handling and deoptimizations in pretty much all browsers.

[0] outside of the global scope through `window` but all variables are clearly local here so that doesn't apply.

Doh! Good point.

AboutSource Built by g1lg1l

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