Sergey Dryganets Sergey Dryganets - 2 months ago 24
Javascript Question

What is the System objects in chrome javascript memory profiler

I'm profiling javascript application using Chrome dev tools.

I see that the only memory area that grows is System objects total.

I wonder how could I understand what causes such behavior as there are no details in the tool showing which system objects got leaked.

I've taken a look at app allocation, but it doesn't change much over time ...
When I'm using timeline feature heap grows over 500mb

initial snapshot"

snapshot after multi-hour usage

snapshot after usage of timeline tool

Answer

According to the JSHeapSnapshot.js implementation in Chromium, as mentioned in a comment by wOxxOm, a comparison for the a given node distance to 100000000 is performed (distances[ordinal] >= WebInspector.HeapSnapshotCommon.baseSystemDistance, where WebInspector.HeapSnapshotCommon.baseSystemDistance = 100000000) and if passing, the size is accumulated into the System segment of the pie chart.

The commit that last modifies this value mentions,

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.

Which indicates that system-space objects on the javascript heap are utilized by debuggers and other internals to the browser (V8, WebKit, etc.). They are outside of the direct control of script allocated heap objects.

wOxxOm also mentioned that the name used to be V8 heap. That is, objects that V8 allocates that are out of reach of the executing script.

It's highly likely that running profiling and taking snapshots performs allocations in that category of heap objects as well, causing the pattern you see of building system allocations over time.

Comments