javascript - chrome javascript内存分析器中的系统对象是什么

标签 javascript memory profiling google-chrome-devtools

我正在使用 Chrome 开发工具分析 javascript 应用程序。

我发现唯一增长的内存区域是 System objects total。

我想知道我怎么能理解导致这种行为的原因,因为工具中没有显示哪些系统对象被泄露的详细信息。

我查看了应用程序分配,但随着时间的推移并没有太大变化... 当我使用时间线功能堆时,会增长超过 500mb

initial snapshot"

snapshot after multi-hour usage

snapshot after usage of timeline tool

最佳答案

根据JSHeapSnapshot.js在 Chromium 中的实现,正如 wOxxOm 的评论中提到的,执行给定节点距离到 100000000 的比较(distances[ordinal] >= WebInspector.HeapSnapshotCommon.baseSystemDistance,其中 WebInspector. HeapSnapshotCommon.baseSystemDistance = 100000000),如果通过,则将大小累积到饼图的System段中。

commit最后修改此值提及,

Currently if a user object is retained by both a system-space object (e.g. a debugger) and another user object, the system object might be shown earlier in the retainers tree. This happens if its distance is smaller than distances of other retaining user objects.

The patch treats links from system-space objects to user objects with less priority, so these links are shown at the bottom of the retainers tree.

这表明 javascript 堆上的系统空间对象被调试器和浏览器的其他内部组件(V8、WebKit 等)使用。它们不受脚本分配的堆对象的直接控制。

wOxxOm 也提到过这个名字曾经是 V8 堆。也就是说,V8 分配的对象超出了执行脚本的范围。

运行分析和拍摄快照很可能也会在该类别的堆对象中执行分配,从而导致您看到随着时间的推移构建系统分配的模式。

关于javascript - chrome javascript内存分析器中的系统对象是什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37150569/

相关文章:

javascript - 一个用于多个文本框的 asp.net 验证器

javascript - Dojo构建系统: Only build dojo when needed?

memory - 有没有更安全的方法使用联合在整数和 float 之间进行转换?

java - HashMap 内存开销

ruby - 如何让 ruby​​-prof 忽略 Ruby 核心/标准库/gem 方法?

javascript - 从相等的元素创建 double 组

php - jQuery 验证,使用 submitHandler 提交

c# - 定时器与 While 循环——内存使用

java - 如何对远程 Java Web 应用程序进行内存分析

java - System.nanoTime() 差异为 0