Since the comments to my previous posts contain a few useful links to memory leaks and closure resources, I thought I'd create a linkdump for future reference. Note that I only included those articles that explain what they're doing and why and give code examples. I ignored the pages that just throw scripts over the fence and leave it to the reader to figure out what they're all about.
Let's start with the horse's mouth: over on MSDN IE developer Justin Rodgers explains the fundamental problems. The first two problems, circular references and closures, are the ones we're trying to address.
On jibbering.com Richard Cornford gives a fundamental overview of JavaScript closures. Although he only briefly touches on memory leaks, and although his article is rather technical and contains too few real-world examples for my taste, it's probably one of the best places to get a solid technical overview.
Mihai Bazon also has a good article on memory leaks and closures, and he treats several real-world event handling examples.
In reaction to my tests, Laurens van den Oever gives some more insight in my test script 5, and how to change it so that it leaks memory. James Mc Parlane, finally, gives a detailed explanation on why my test script 4 leaks (though he uses a slightly different example).
If you know of more resources, please add a comment. Note, though that I'm only interested in resources that explain what they're doing and why. Links to resources that don't explain themselves well will be removed.
This is the blog of Peter-Paul Koch, web developer, consultant, and trainer.
You can also follow
him on Twitter or Mastodon.
Atom
RSS
If you like this blog, why not donate a little bit of money to help me pay my bills?
Categories:
Comments are closed.
1 Posted by Sébastien Mouren on 23 October 2005 | Permalink
Here is Eric Lippert (a MS developer) take on closures and on memory leaks: http://blogs.msdn.com/ericlippert/archive/2003/09/17/53028.aspx
2 Posted by James Mc Parlane on 24 October 2005 | Permalink
Its worse than I thought. I've modified my original post after reading this article by Richard Cornford http://jibbering.com/faq/faq_notes/closures.html and carring out some experiments.
3 Posted by Gilles on 29 October 2005 | Permalink
Laurens vd Oever has updated his script, he claims it is now leak-free: http://laurens.vd.oever.nl/weblog/items2005/closures/
Maybe you're interested.