如何找到JS内存泄漏? [英] How to find JS Memory Leaks?
问题描述
是否有任何提示如何在chrome中使用堆转储来查找JS代码内存泄漏,无法通过GC清理的代码...以及如何找到即使从dom中删除的元素也乱搞?
换句话说,如何读取堆正确地转存到chrome中?统治者观点?比较?
Google为此开放了一个工具, leak-finder-for-javascript 。他们还提出了一种所谓的三快照技术(另请参阅本文)。
泄漏探测器链接的第一段
$ b
注意:jsleakcheck不再支持!它正在针对一种非官方且不稳定的开发工具协议来获取堆快照。
该协议正在开发中,并且它不够稳定,因此I
可以让jsleakcheck与各种Chrome版本一起工作。在
之外,还有一个较低级别的兼容性工具
remote_inspector_client.py,jsleakcheck用于与开发工具沟通
,已被移除。
I have struggled around with the heap profiler in chrome but it is very confusing. Especially if there are minimized libraries inside. But even the DOMElements views, elements which may not be removed are very unclear presented.
Are there any tips how to use the heap dump in chrome to find JS code that leads to memory leaks, code that cannot be cleaned by GC... and how to find elements messing around even if removed from dom?
In other words, how to read heap dump in chrome correctly? Dominators View? Comparison?
Google open sourced a tool for this purpose, leak-finder-for-javascript. They also proposed a method so-called the three snapshot technique (also see a brief description in this article).
First paragraph of the leak-finder link
Note: jsleakcheck is no longer supported! It was working against an unofficial and unstable Dev Tools protocol for taking heap snapshots. The protocol is being worked on, and it is not stable enough so that I could keep jsleakcheck working with various Chrome versions. In addition, a lower level compatibility tool, remote_inspector_client.py, which jsleakcheck was using to communicate with Dev Tools, got removed.
这篇关于如何找到JS内存泄漏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!