If you want to see the memory usage for each compartment, you can do so by visiting in about:memory?verbose and looking in the "Explicit Allocations" tree at the top. (Nb: The "?verbose" part is important; if you omit that then parts of the "Explicit Allocations" tree will be hidden and you won't see measurements for all compartments.) Each compartment gets a subtree that is headed with
Per-compartment memory reporters allow you to look at about:memory to see what compartments are present. Once you close a tab containing a web page, all the compartments associated with that web page should disappear. (But note that they won’t necessarily disappear immediately; garbage collection and/or cycle collection has to run first.)
Sometimes this doesn’t happen and you end up with a Zombie Compartment. This shouldn’t happen, and it indicates a bug. It also makes children and 1950s B-movie actresses scream.
If you notice Zombie Compartments while browsing, please report them to The Authorities. Here are some steps you can follow when reporting one that will increase the chance it’ll be hunted down.
- First, you should use about:memory?verbose for diagnosis. You want the “?verbose” suffix (which you can also get to by clicking the “More verbose” link at the bottom of about:memory) otherwise small compartments might be omitted.
- Second, beware that many sites utilize scripts from other origins. Scripts from Google, Facebook and Twitter are particularly common. This means that the most reliable diagnosis of a Zombie Compartment occurs if you do the following: start Firefox anew, open about:memory?verbose and one other tab, then close that other tab, then hit “minimize memory usage” at the bottom of about:memory?verbose several times to force multiple garbage and cycle collections. (Sometimes hitting it once isn’t enough, I’m not sure why.) If the compartment remains, it’s very likely a Zombie Compartment.
- After that, try waiting a while, say 10 or 20 minutes, then try the “minimize memory usage” button again. Some Zombie Compartments stick around for a limited time before disappearing; others are immortal, and it’s useful to know which is which.
- Some Zombie Compartments are caused by add-ons. So if you have add-ons enabled, please try to reproduce in safe mode, which disables them. If you can identify, by disabling them one at a time, a single add-on that is responsible, that is extremely helpful. Zombie compartments that are caused by add-ons are definitely interesting, but their importance depends on the popularity of the add-on.
- Finally, please file a bug that includes all the information you’ve gathered, add “[MemShrink]” to its whiteboard, and mark it as blocking bug 668871. Attaching the full contents of about:memory?verbose is very helpful. See bug 669545 for an example.
Please, stop the screaming. Report Zombie Compartments to The Authorities.