Hacker News new | past | comments | ask | show | jobs | submit login

This article is just badly written. It doesn't provide or make reference to a precise documentation of the issue. It's not clear whenever it applies to `delete x` or also `delete obj[x]`. It doesn't provide a reproductible use case or list of browsers that are affected. It mentions issues with scope but doesn't go in detail of which ones are triggering the issue. For what it's worth it might apply only to IE6.

`delete obj[x]` removes not only the reference to the value but also the key which prevents other forms of memory leak.




There is another one from "Smashing Magazine" [1], I think it's written better :

> In quite a few discussions online about reclaiming memory in JavaScript, the delete keyword is brought up, as although it was supposed to be used for just removing keys from a map, some developers think you can force de-referencing using it. Avoid using delete if you can. In the below example, delete o.x does a lot more harm than good behind the scenes, as it changes o‘s hidden class and makes it a generic slow object.

Although it's from 3 years ago it looks decent. The comments below are even more interesting than the article.

[1] : http://www.smashingmagazine.com/2012/11/05/writing-fast-memo...




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: