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):
- Sieve
- Drip
- JavaScript Memory Leak Detector
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
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?
Another tool for you: JavaScript Memory Validator.
Shows allocations, objects, hotspots, generations, snapshots, etc.
Works with Firefox 1.0 through 3.6.
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.
精彩评论