Jan/090
JavaScript: Memory leak detection
While developing the new JavaScript front-end for NagVis 1.4 I needed to to find some memory leaks in my JavaScript code. I was searching for some useful programs which analyze a running JavaScript in the browser an search for leaks in it. A lot of such memory leaks in JavaScript are browser specific. So you need a program which finds the browser specific leaks. But there are also general problems in JavaScript and DOM Interaction. It is hard to find and learn all the leak patterns out there in the different browser engines. If you like to try just search a bit – there are a lot of sites with more information about what and why something is leaking. I provide a small overview about tools which may support you by searching for memory leaks.
- Microsoft JavaScript Memory Leak Detector
This is an add on for Internet Explorer provided by Microsoft. I tried a lot to get this work properly but was not able to. So it was useless for me. Maybe you are more lucky than me… - Drip
Drip is based on the Internet Explorer engine. You can open some website in drip, wait some time and then click “Show DOM leaks”. The page closes and Drip shows a list of objects which are still in memory. This tool only shows the result, not the reason for leaks. But it is handy for focus your search. - Firefox Addon: Leak Monitor 0.4.2
The leak monitor is an open source extension for Firefox. It is primary meant to track memory leaks in Firefox extensions but it creates a pop up window when you leave some page with a leak. I could not find any leaks with it. It was useless for me on tracking leaks. - SoftwareVerification JavaScript Memory Validator
This is a commercial application which uses the Firefox in background. The developers like to add support for Internet Explorer but according to them it is not possible at the moment.
The JavaScript Memory Validator monitors the memory usage and number of calls of the functions and methods of your website. It has a very handy feature called “hot spots”. With this you can find some critical parts of your code where you should focus your search on. I tested the trial of this program, working around some bugs, I was very excited of this program. I was able to find and track down some leaks with it.
You know other tools to track down memory leaks in JavaScript? Please leave a comment…







