10

Our team is faced with slow but serious Javascript memory leak. We have read up on the normal causes for memory leaks in Javascript (eg. closures and circular references).

We tried to avoid those pitfalls in the code but it likely we still have unknown mistakes left.

I started my search for available tools but would like input from people with actual experience with these tools.

Some of the tools I found so far (but have no idea how good and useful they would be for our problem):

Our search is not limited to free tools, it will be a bonus, but more importantly something that will get the job done.

We do the following in our Javascript code:

  • AJAX calls to a .NET WCF back-end that send back JSON data
  • Manipulate the DOM
  • Keep a fairly sized object model in the Javascript to store current state
Philip Fourie
  • 111,587
  • 10
  • 63
  • 83

3 Answers3

2

sIEve is for memory leaks in IE specifically. What I like about it is that you can reliably reproduce the steps used and capture action-able data. See the following:

How to use IE7 Javascript memory leak detectors?

Community
  • 1
  • 1
Dexygen
  • 12,287
  • 13
  • 80
  • 147
  • Thanks we gave it a try. Not a bad tool. It worked on IE7 but not on IE8. We still couldn't work out what is causing the leak with this tool, might be because we didn't use the tool correctly... – Philip Fourie Mar 16 '10 at 07:41
1

I have used the JavaScript Memory Leak Detector and I can tell you it works great.

What dynamic engine are you using? Based on the mention of a .Net web service, I'm guessing that you are using ASP.Net. Is that correct? You may want to look at the ASP.Net AJAX JavaScript library. It was built in a way that helps this situation. All components have a dispose() method that allows you to remove references to DOM objects. When I switched to ASP.Net AJAX, my page became much more responsive.

Gabriel McAdams
  • 56,921
  • 12
  • 61
  • 77
  • This tool looked promising but never reported anything at all; the controls always stayed empty. Come to think of it might be that it doesn't run on IE8. I will try it again on IE7 and report back. Thanks for the tip on the AJAX Javascript library. Our solution uses custom Javascript components with JQuery, so it would not work for us. – Philip Fourie Mar 16 '10 at 07:49
  • Yeah. This tool is for IE versions before IE8. That is because the memory leak issues they test for have been fixed in IE8. If the memory leaks you spoke of occur in IE8 (or Firefox, etc), then I don't think any of these tools will be able to help you. They test for code that causes leaks in IE versions before IE8. – Gabriel McAdams Mar 16 '10 at 15:29
1

Another tool for you: JavaScript Memory Validator.

Shows allocations, objects, hotspots, generations, snapshots, etc.

Works with Firefox 1.0 through 3.6.

Stephen Kellett
  • 3,078
  • 1
  • 22
  • 25
  • Was pleasantly surprised with this tool. Maybe the best of the ones we evaluated. It is a bit unpolished on the edges. Crashed a couple of times and was really slow, but got the job done albeit a bit frustrating to use. – Philip Fourie Mar 16 '10 at 07:45
  • Were you actually able to use this tool? We tried using it but first it does a scan of the system (lord knows what its scanning for), and finds plugin-container. then when you do launch application, nothing happens. – flexicious.com Mar 13 '13 at 04:48