Are there any add-ons for Firefox that I can use to find out with part of the JavaScript causes memory leaks?
3 Answers
I've got nothing for firefox, but the webkit inspector in Chrome has a profiler built in that is great for that kind of thing.
As an added bonus it also shows you all browser events such as repaints, so you can engineer your code to have the least impact on the browser.
5 Comments
Lightness Races in Orbit
-1: That's completely useless when the leak only occurs in Firefox. Does not answer the question whatsoever.
Daniel Lyons
@LightnessRacesinOrbit that would only be a problem if your code had wholly separate codepaths for FF. Probably 95% of the time fixing a memory leak in Chrome will fix it for all the other browsers.
RGPT
@DanielLyons I have to agree with LightnessRacesinOrbit on this. It is not the correct answer because of those 5% you are saying. Would you consider your software correct if it was not doing what it was suppose to 5% of the times? It is a helpful answer (agree with you on that) but it is not the correct one for the question. Having said I am in those 5% now, so that is why I am saying this. (can you imagine a bridge that will only stand 95% of the times it gets high winds?)
Daniel Lyons
@RGPT A long time ago, in a galaxy far, far away…
prdatur
Does not help, because Firefox was requested, I really searched for Firefox
Use Drip.exe / IEleak, I used it a lot to search for memory leaks!
Other hits:
- jQuery itself prevents a lot of memory leaks!
- Test your code with http://jslint.com
- There is a tool by Microsoft itself, but I don't know it is up to date: http://blogs.msdn.com/b/askie/archive/2008/12/31/javascript-memory-leak-detector-for-internet-explorer.aspx
- There is also integration with Visual Studio: http://berniesumption.com/software/how-to-debug-javascript-in-internet-explorer/
- There is a good article about mem leaks http://www.ibm.com/developerworks/web/library/wa-memleak/
- http://www.debugbar.com/?langage=en
Comments
The best memory profiler I've found is for IE (supports even IE6 ;-). Give it a go - you will be surprised how good it is:
1 Comment
Josh Mouch
I tried evaluating dynaTrace, and I don't see any memory profiling features at all. However, it does look pretty cool for general performance profiling.