问题描述
我有一个 Web 应用程序,它在某处发生内存泄漏,但我无法检测到它.我已经尝试过通常运行良好的 Chrome 开发人员工具,但我无法追踪负责的代码行.Chrome 工具给了我太多信息,我无法将内存中的对象与我的代码相关联.
I have a web application which has a memory leak somewhere and I am unable to detect it. I already tried the Chrome developer tools which normally works great, but I am unable to track down the lines of code which are responsible. The Chrome tools just give me too much information and I can't relate the objects in memory to my code.
还有其他可能有用的工具吗?
Are there any other tools that might be helpful?
推荐答案
更新:让我们使用记录堆分配配置文件类型.
update:Lets use Record Heap Allocations profile type.
- 打开 devtools 分析器
- 做一个热身动作
- 启动分析器
- 重复几次动作
- 如果操作有泄漏,您将在概览窗格中看到相同数量的蓝色条组
- 停止分析器
- 在概览中选择一组这些蓝色条
- 查看对象列表
查看截屏视频 Javascript 内存泄漏检测(Chrome DevTools)
是:您可以使用下一个场景来解决内存泄漏问题.
was:You can use the next scenario for fining memory leaks.
- 打开 devtools 分析器
- 做一个导致泄漏的动作
- 拍摄堆快照
- 重复第 2 步和第 3 步的树次
- 选择最新的堆快照
- 将过滤器所有对象"更改为快照 1 和 2 之间的对象"
之后,您将看到一组泄漏的对象.您可以选择一个对象并查看对象的保留树中的保留器列表
After that you will see objects a set of leaked objects.You can select an object and look at the list of retainers in Object's retaining tree
这篇关于追踪 JavaScript 内存泄漏的工具的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!