News for hackers. Stuff that matters.
Re:JavaScript memory leak patterns by cscotta on Sunday February 07, 2010 @02:56PM (#1108148)
This article is a good description of circular references and memory leaks in JS, a pattern which is especially common in IE6 and one which my coworkers have spent a surprising amount of time combatting. Memory leaks border on a special kind of hypochondria, but once you can prove they exist, they're a bear to track down.

The biggest surprise in this article, however, was in the bio:

_"He has worked as a part of the OS/2 IBM Web Browser Support Team for the past three years."_

The OS/2 Web Browser was Mozilla-based, with open development happening in the free WarpZilla project. Apparently WarpZilla, a port of Firefox to OS/2, is still going strong as of version 3.5.4 (with prereleases of Fx3.6 and Fx3.7 still available): http://www.mozilla.org/ports/os2/

Re:JavaScript memory leak patterns by cbetz on Sunday February 07, 2010 @08:36PM (#1108662)
Please correct me if I am wrong, but shouldn't developers only worry about the issues mentioned in the article on older browsers? (I'm thinking IE6 and earlier).

Introducing a leak via circular references would be considered a bug in most modern JS engines, right?

A related question: Can someone recommend a good plugin/extension for monitoring the size of a page's javascript memory usage over time?

Re:JavaScript memory leak patterns by BudVVeezer on Sunday February 07, 2010 @10:26PM (#1108836)
I think developers should always try to avoid poor programming practices instead of relying on implementation details of the browser.
Re:JavaScript memory leak patterns by natrius on Sunday February 07, 2010 @11:51PM (#1109006)
Poor programming practices? The code that creates circular references is clearer than the example workarounds. Sacrificing clarity to avoid a problem that doesn't occur in supported browsers doesn't make much sense.
Re:JavaScript memory leak patterns by BudVVeezer on Monday February 08, 2010 @09:23AM (#1109751)
Failing to call "delete" on a pointer you "new"'ed in C++ is also clearer, and just as incorrect. The ECMAScript spec makes no mention of how memory will be managed for the user. Right or wrong in terms of clarity, it's still a poor practice to assume the browser will behave in a particular way that's not covered by the specification (regardless of how sensible that behavior might be!).
Re:JavaScript memory leak patterns by mhansen on Sunday February 07, 2010 @10:06PM (#1108790)
Chrome's Web Inspector lets you take heap snapshots at different times. It won't give you a graph of memory usage, but it will let you monitor it at different times
Re:JavaScript memory leak patterns by Plugawy on Sunday February 07, 2010 @03:09PM (#1108165)
One more way of avoiding memory leaks is event delegation - here's quite good article about it: http://www.sitepoint.com/blogs/2008/07/23/javascript-event-d...