Skip to main content

memlab analyze object-size

Get the largest objects in heap

memlab analyze object-size 

Example output​

$ memlab analyze object-size --snapshot /tmp/memlab-example/leak/data/cur/s3.heapsnapshot
· @71395 Array: 3 edges, 800KB, refs: [history]
· @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__]
· @32601 object shape system / DescriptorArray: 1620 edges, 9.9KB, refs: [descriptors]
· @46589 object shape system / DescriptorArray: 1620 edges, 9.9KB, refs: [descriptors]
· @65837 string string: 2 edges, 9.7KB, refs: [source]
· @65097 Document: 576 edges, 8.6KB, refs: [prototype, __proto__]
· @68575 Element: 342 edges, 7.6KB, refs: [__proto__, prototype]
· @71101 system / Context / scope @66489: 47 edges, 7KB, refs: [createFunction, fe, pQuerySelector, $, pQuerySelectorAll, de, U, V, q, xpathQuerySelectorAll]
· @47971 string string: 4 edges, 6.9KB, refs: [parent, settingNames]
· @71393 Array: 243 edges, 6.2KB, refs: [labels]
· @69421 HTMLElement: 412 edges, 4.8KB, refs: [__proto__, prototype]
· @70271 SVGElement: 341 edges, 4.5KB, refs: [prototype]
· @71055 object shape system / DescriptorArray: 441 edges, 3KB, refs: [descriptors]
· @17139 string string: 4 edges, 2.7KB, refs: [source]
· @67513 closure t: 12 edges, 2.4KB, refs: [constructor, t, c, Deferred]
· @7393 Object { constructor, toDateString, toISOString, toString, toTimeString, ... }: 51 edges, 2.1KB, refs: [prototype]
· @7533 Object { constructor, toDateString, toISOString, toString, toTimeString, ... }: 51 edges, 2.1KB, refs: [prototype]
· @7721 Object { constructor, toDateString, toISOString, toString, toTimeString, ... }: 51 edges, 2.1KB, refs: [prototype]
· @71005 object shape system / DescriptorArray: 271 edges, 2.1KB, refs: [descriptors]
· @67717 object shape system / Map: 15 edges, 2.1KB, refs: [map]
· @34799 Math: 49 edges, 1.8KB, refs: [value, Math]
· @40871 Math: 49 edges, 1.8KB, refs: [value, Math]
· @53461 Math: 49 edges, 1.8KB, refs: [value, Math]
· @7497 closure RegExp: 70 edges, 1.8KB, refs: [constructor, value, RegExp, regexp_function]
· @7685 closure RegExp: 70 edges, 1.8KB, refs: [constructor, value, RegExp, regexp_function]
· @41141 console: 31 edges, 1.8KB, refs: [value, console]
· @53467 console: 31 edges, 1.8KB, refs: [value, console]
· @66017 Node: 68 edges, 1.8KB, refs: [__proto__, prototype]
· @7881 closure RegExp: 70 edges, 1.7KB, refs: [constructor, value, RegExp, regexp_function]
· @64283 string string: 2 edges, 1.7KB, refs: [source]
· @48235 closure SettingsDialog: 10 edges, 1.7KB, refs: [constructor]
· @70999 object shape system / DescriptorArray: 283 edges, 1.7KB, refs: [descriptors]

How to read the output​

memlab analyze object-size lists the objects with the largest retained size. Objects retained by a larger object in the list are left out, so each line is a separate chunk of memory.

Each line is @id type name: N edges, retained size, refs: [...], where refs lists the names of the references that point to the object. Here the top entry is an 800KB Array referenced as history: the history array of a settings dialog that was closed but is still in memory.

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.