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

查看:119
本文介绍了用于跟踪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?

推荐答案

更新:
让我们使用记录堆分配个人资料类型。


  1. open devtools profiler

  2. 做一个热身活动

  3. 启动探查器

  4. 重复动作几次

  5. 如果操作有泄漏,您将在概览窗格中看到相同数量的蓝条组

  6. 停止探查器

  7. 在概览中选择一组这些蓝条

  8. 查看对象列表

  1. open devtools profiler
  2. do a warm-up action
  3. start profiler
  4. repeat action a few times
  5. if the action has a leak you will see the same number of groups of blue bars in the overview pane
  6. stop the profiler
  7. select one group of these blue bars in the overview
  8. look into the list of objects

请参阅截屏视频 Javascript内存泄漏检测(Chrome DevTools)

是:
您可以使用下一个方案来消除内存泄漏。

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


  1. open devtools profiler

  2. 做一个泄密的行动

  3. 拿一堆快照

  4. 重复步骤2和3树时间

  5. 选择最新的堆快照

  6. 更改过滤器全部对象到快照1和2之间的对象

  1. open devtools profiler
  2. do an action that makes a leak
  3. take a heap snapshot
  4. repeat steps 2 and 3 tree times
  5. select the latest heap snapshot
  6. change filter "All Object" to "Objects between Snapshot 1 and 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天全站免登陆