用于跟踪JavaScript内存泄漏的工具 [英] Tool to track down JavaScript memory leak
问题描述
我有一个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?
推荐答案
更新:
让我们使用记录堆分配个人资料类型。
- open devtools profiler
- 做一个热身活动
- 启动探查器
- 重复动作几次
- 如果操作有泄漏,您将在概览窗格中看到相同数量的蓝条组
- 停止探查器
- 在概览中选择一组这些蓝条
- 查看对象列表
- open devtools profiler
- do a warm-up action
- start profiler
- repeat action a few times
- if the action has a leak you will see the same number of groups of blue bars in the overview pane
- stop the profiler
- select one group of these blue bars in the overview
- look into the list of objects
请参阅截屏视频 Javascript内存泄漏检测(Chrome DevTools)
是:
您可以使用下一个方案来消除内存泄漏。
was: You can use the next scenario for fining memory leaks.
- open devtools profiler
- 做一个泄密的行动
- 拿一堆快照
- 重复步骤2和3树时间
- 选择最新的堆快照
- 更改过滤器全部对象到快照1和2之间的对象
- open devtools profiler
- do an action that makes a leak
- take a heap snapshot
- repeat steps 2 and 3 tree times
- select the latest heap snapshot
- 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屋!