JavaScript Memory Leaks

On one of my projects,, I recently noticed severe performance degradation in IE6 when the browser remains open. As it turns out a lot of the techniques used by various JavaScript Frameworks, and even my own JavaScript architecture, causes memory leaks. This is especially prominent in IE6, because its memory manager has poor heuristics for detecting JavaScript leaks. Its not as important in better browsers like, FireFox, but I do notice that Firefox slowly eats up memory as well (although this may be a documented browser memory leak). It was particularly noticeable on Mint because our JavaScript library has become bloated to many thousand lines of code and IE6 just cant handle it.


The FireFox memory leak, is actual a feature and not a bug. If you want to prevent FireFox from using too much memory, read this article:
Debunking Another Myth FireFoxs Memory Leak Bug.

Some things to improve performance are: use fewer closures, avoid circular references, and when appending DOM elements always append from the document down. There is a lot of information on this issue and the browsers are dramatically improving. However, these three articles cover everything you really need to know:

IE Leak Patterns
Closures and Circular References
Leak Patterns