From:  Nick Fitzgerald <nfitzgerald@mozilla.com>
Date:  15 Jan 2016 05:50:49 Hong Kong Time
Newsgroup:  news.mozilla.org/mozilla.dev.memory
Subject:  

Dominator tree memory analysis now in Nightly

NNTP-Posting-Host:  63.245.214.181

Hi folks!

Dominator trees give you fine-grained insight into memory retention.

In a graph rooted by some node R, a node A is said to dominate B iff every path to B starting from R passes through A. In the context of a heap graph, another way to say this would be that A is retaining B: if the garbage collector found A to be unreachable and eligible for reclaiming, than B would also be unreachable and eligible for reclaiming.

We also use this to calculate the "true" memory cost of a node in the heap graph. This is the "retained size" and contrasts with the naive "shallow size". For example, imagine a large binary tree where there are no outside references into subtrees, only to the root. The root node itself has a small shallow size: a left branch pointer, a value, and a right branch pointer. However, it is retaining the whole rest of this large tree's structure, and so its retained size is significant.

Here is a screenshot of the dominator tree (combined with allocation stack tracking) in action to debug the memory overhead of loading large source files in a CodeMirror editor: http://i.imgur.com/sGsVJb9.png

And here is a reminder of how to enable to memory tool within the devtools: http://i.imgur.com/hEPTqrT.png

If you would like to use this tool for the whole runtime rather than scoped to a single tab, use the browser toolbox. Here are instructions for enabling and using the browser toolbox: https://developer.mozilla.org/en-US/docs/Tools/Browser_Toolbox

Please try it out, give me your feedback, and file bugs in the "Firefox" product and "Developer Tools: Memory" component!

My thanks to the folks who reviewed patches for this feature: Jordan Santell, Steve Fink, Boris Zbarsky, and Jim Blandy.

Cheers,

Nick