追踪 JavaScript 内存泄漏的工具 [英] Tool to track down JavaScript memory leak

查看:40
本文介绍了追踪 JavaScript 内存泄漏的工具的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 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.

  1. 打开 devtools 分析器
  2. 做一个热身动作
  3. 启动分析器
  4. 重复几次动作
  5. 如果操作有泄漏,您将在概览窗格中看到相同数量的蓝色条组
  6. 停止分析器
  7. 在概览中选择一组这些蓝色条
  8. 查看对象列表

查看截屏视频 Javascript 内存泄漏检测(Chrome DevTools)

是:您可以使用下一个场景来解决内存泄漏问题.

was: You can use the next scenario for fining memory leaks.

  1. 打开 devtools 分析器
  2. 做一个导致泄漏的动作
  3. 拍摄堆快照
  4. 重复第 2 步和第 3 步的树次
  5. 选择最新的堆快照
  6. 将过滤器所有对象"更改为快照 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 内存泄漏的工具的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆