memlab analyze object-fanout
Get objects with the most out-going references in heap
memlab analyze object-fanout
Example output
$ memlab analyze object-fanout --snapshot /tmp/memlab-example/leak/data/cur/s3.heapsnapshot
· @32601 object shape system / DescriptorArray: 1620 edges, 9.9KB, refs: [descriptors]
· @46589 object shape system / DescriptorArray: 1620 edges, 9.9KB, refs: [descriptors]
· @40065 Window [JSGlobalObject] / http://localhost:3000: 673 edges, 49.4KB, refs: [prototype, global_object]
· @33803 Window [JSGlobalObject] / http://localhost:3000: 670 edges, 46.1KB, refs: [prototype, global_object]
· @65097 Document: 576 edges, 8.6KB, refs: [prototype, __proto__]
· @52945 Document: 576 edges, 5.8KB, refs: [prototype, __proto__]
· @32151 Window (prototype) / http://localhost:3000: 535 edges, 26.7KB, refs: [__proto__, prototype]
· @46239 Window (prototype) / http://localhost:3000: 535 edges, 26.7KB, refs: [prototype, __proto__]
· @32945 Window (internal cache) / http://localhost:3000: 534 edges, 10.2KB, refs: []
· @46141 Window (internal cache) / http://localhost:3000: 534 edges, 10.2KB, refs: []
· @71055 object shape system / DescriptorArray: 441 edges, 3KB, refs: [descriptors]
· @50117 HTMLElement: 412 edges, 3.5KB, refs: [prototype, __proto__]
· @69421 HTMLElement: 412 edges, 4.8KB, refs: [__proto__, prototype]
· @49255 Element: 342 edges, 3.9KB, refs: [prototype, __proto__]
· @68575 Element: 342 edges, 7.6KB, refs: [__proto__, prototype]
· @70271 SVGElement: 341 edges, 4.5KB, refs: [prototype]
· @70999 object shape system / DescriptorArray: 283 edges, 1.7KB, refs: [descriptors]
· @71005 object shape system / DescriptorArray: 271 edges, 2.1KB, refs: [descriptors]
· @71393 Array: 243 edges, 6.2KB, refs: [labels]
· @34149 Object [JSGlobalObject]: 71 edges, 6.5KB, refs: [prototype, global_object, security_token]How to read the output
memlab analyze object-fanout lists the objects with the most outgoing references. A collection with a huge number of entries is often a cache or registry that never removes anything.
Each line is @id type name: N edges, retained size, refs: [...], where refs lists the names of the references that point to the object. The top entries in a browser are usually engine and DOM metadata (DescriptorArray, Window, Document). Here the Array referenced as labels, with 243 edges, is the dialog's list of row labels.
Options
--snapshot: set file path of the heap snapshot under analysis--output: specify output format of the analysis (available options: 'text', 'json'; defaults to 'text')
The universal options (--help, --verbose, ...) work with this command too.