使用萤火虫在 JavaScript 中查找内存泄漏?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5028479/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Finding memory leaks in JavaScript using firebug?
提问by cometta
Are there any add-ons for Firefox that I can use to find out with part of the JavaScript causes memory leaks?
是否有任何适用于 Firefox 的附加组件可以用来找出部分 JavaScript 导致内存泄漏?
采纳答案by xzyfer
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.
我对 Firefox 一无所知,但 Chrome 中的 webkit 检查器内置了一个分析器,非常适合这种事情。
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.
作为一个额外的好处,它还会向您显示所有浏览器事件,例如重绘,因此您可以设计代码以将对浏览器的影响最小。
回答by powtac
Use Drip.exe/ IEleak, I used it a lot to search for memory leaks!
使用Drip.exe/ IEleak,我经常用它来搜索内存泄漏!
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
- jQuery 本身可以防止大量内存泄漏!
- 使用http://jslint.com测试您的代码
- 微软本身有一个工具,但我不知道它是最新的:http: //blogs.msdn.com/b/askie/archive/2008/12/31/javascript-memory-leak-detector- for-internet-explorer.aspx
- 还有与 Visual Studio 的集成:http: //berniesumption.com/software/how-to-debug-javascript-in-internet-explorer/
- 有一篇关于内存泄漏的好文章http://www.ibm.com/developerworks/web/library/wa-memleak/
- http://www.debugbar.com/?langage=en
回答by Jakub Konecki
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:
我发现的最好的内存分析器适用于 IE(甚至支持 IE6 ;-)。试一试 - 你会惊讶它有多好:

