Week 53-54? We’ve been going for over a year! To celebrate MemShrink’s 1st birthday, I wrote about the major achievements we’ve made in the past year.
Memory Reporting
I overhauled the cross-cutting “Other Measurements” shown for JavaScript in about:memory. It’s now in two parts. The first part is a functional breakdown of the memory consumption of the main JavaScript runtime, i.e. all JavaScript memory usage outside of web worker threads. Here’s an example.
194,179,064 B (100.0%) -- js-main-runtime ├──159,064,360 B (81.92%) -- compartments │ ├───73,850,880 B (38.03%) -- gc-heap │ │ ├──22,014,080 B (11.34%) -- objects │ │ │ ├──14,119,616 B (07.27%) ── non-function │ │ │ └───7,894,464 B (04.07%) ── function │ │ ├──19,553,168 B (10.07%) ── unused-gc-things │ │ ├──14,014,208 B (07.22%) -- shapes │ │ │ ├───6,747,240 B (03.47%) ── tree │ │ │ ├───4,926,000 B (02.54%) ── dict │ │ │ └───2,340,968 B (01.21%) ── base │ │ ├──10,204,960 B (05.26%) ── strings │ │ ├───5,338,816 B (02.75%) ── scripts │ │ ├───1,493,472 B (00.77%) ── type-objects │ │ ├───1,229,456 B (00.63%) ── arena-admin │ │ └───────2,720 B (00.00%) ── sundries │ ├───29,459,680 B (15.17%) ── analysis-temporary │ ├───14,484,704 B (07.46%) ── script-data │ ├───13,062,744 B (06.73%) ── string-chars │ ├────9,300,704 B (04.79%) -- shapes-extra │ │ ├──3,325,952 B (01.71%) ── compartment-tables │ │ ├──2,845,984 B (01.47%) ── tree-tables │ │ ├──2,125,056 B (01.09%) ── dict-tables │ │ └──1,003,712 B (00.52%) ── tree-shape-kids │ ├────7,688,912 B (03.96%) -- type-inference │ │ ├──5,750,576 B (02.96%) ── script-main │ │ ├──1,368,560 B (00.70%) ── object-main │ │ └────569,776 B (00.29%) ── tables │ ├────6,232,272 B (03.21%) -- objects │ │ ├──4,406,720 B (02.27%) ── slots │ │ ├──1,726,640 B (00.89%) ── elements │ │ └─────98,912 B (00.05%) ── misc │ ├────4,256,768 B (02.19%) ── cross-compartment-wrappers │ └──────727,696 B (00.37%) ── mjit-data ├───19,472,384 B (10.03%) -- gc-heap │ ├──18,006,016 B (09.27%) ── unused-arenas │ ├───1,458,176 B (00.75%) ── chunk-admin │ ├───────8,192 B (00.00%) ── decommitted-arenas │ └───────────0 B (00.00%) ── unused-chunks └───15,642,320 B (08.06%) ── runtime
The contents of the “js-main-runtime/compartments” sub-tree is the sum of all the individual compartment entries in the “explicit/js” sub-tree, and the “js-main-runtime” total is the same as the “explicit/js” total. This new view will become more important when per-tab memory reporting is implemented which will cause each tab’s JavaScript memory consumption to be reported separately.
The second part is designed to show the utilization of the garbage-collected heap. The new measurements and presentation are more detailed and easier to understand than the old version. Here’s an example.
93,315,072 B (100.0%) -- js-main-runtime-gc-heap-committed ├──55,755,888 B (59.75%) -- used │ ├──53,068,256 B (56.87%) ── gc-things │ ├───1,458,176 B (01.56%) ── chunk-admin │ └───1,229,456 B (01.32%) ── arena-admin └──37,559,184 B (40.25%) -- unused ├──19,553,168 B (20.95%) ── gc-things ├──18,006,016 B (19.30%) ── arenas └───────────0 B (00.00%) ── chunks
One thing this makes clear is that our “unused” fraction is often very high. We’ll need a compacting generation garbage collector to really fix that. This is being actively worked on, but it’s a large task.
Nathan Froyd had a productive couple of weeks.
- He added a memory reporter nsIDocument’s property tables.
- He measured some more stuff under the “xpti-working-set” reporter.
- He measured some more stuff under the “atom-table” reporter, renaming it “atom-tables” in the process.
- He measured some more stuff in the DOM multi-reporter.
These four reporters don’t cover a great deal of memory, but that’s inevitable these days; all the low-handing “heap-unclassified” fruit is gone, and the remaining improvements will necessarily be small. We’re gradually closing in on the target of 10%, though I’m not sure we’ll ever get there.
Nils Maier added some more identifying information to JavaScript sandboxes, which will help identify them in about:memory.
Bas Schouten added a memory reporter for VRAM used by Azure.
Fixed Leaks
Robert O’Callahan fixed a leak involving canvas, which I won’t pretend to understand. This also fixed bug 757749.
Cervantes Yu fixed a B2G memory leak that would leak about 1MB of memory per day. This was found by Valgrind, under the operation of Julian Seward.
Quote of the Week
A Hacker News thread contained the following comment.
Mozilla needs to focus on making its browser consume less memory and CPU when idle. These are the things that are killing its marketshare and leading users to switch to alternatives. Every time I see initiatives like the password account manager, iOS apps that use web view, a browser based editor and what not I just scratch my head because Firefox marketshare is plummeting and the old refrain “just wait until the next version” was tired since 3.0. Instead the general response is to get defensive and list new features. Yeah and are those new features stopping the user drain? Nope. Firefox is a sluggish memory sucking heap of software that drains resources even when it isn’t being used.
I love and cherish Firefox as a product and a brand, because you have achieved a lot in your past. But now you are failing and it is depressing to see this happen.
That’s not the quote of the week, BTW; I’ve heard variations of that many times before, and while it had some truth to it 18 months ago, that piece of conventional wisdom is now well past its use-by date. Pleasingly, there was quite a bit of push-back in response. My favourite comment, which is the quote of the week, was the following.
Firefox is to Ford what Chrome is to Toyota. Even if Firefox is as reliable and efficient as Chrome these days, some people still see it as being the gas-guzzling unreliable Ford vehicle of yesteryear.
A bad reputation is a difficult thing to lose.
Bug Counts
Here are the current bug counts.
- P1: 23 (-2/+0)
- P2: 87 (-10/+9)
- P3: 106 (-3/+3)
- Unprioritized: 2 (-2/+2)
A net change of -2 P1 bugs, and -1 P2 bugs. Not bad!



