compartments Firefox Memory consumption MemShrink

Zombie compartments! Recognize and report them. Stop the screaming.

Update (November 30, 2011): I wrote a wiki page about zombie compartments.  It’s much clearer than this post, you should read it instead.

Update (July 31, 2011): This blog post has been linked to from‘s front page.  Although any help in improving Firefox’s memory usage is very welcome, please note that this post was aimed at Firefox developers and other technically-inclined users, and I wasn’t expecting its existence to be publicized so widely.   Furthermore, the per-compartment reporters that help identify zombie compartments were only added to Firefox 7 (currently in the Aurora channel), and several existing bugs that cause zombie compartments have been subsequently fixed in the Firefox 8 development code.  This means the hunting of zombie compartments is a sport best left to those who either are using Nightly builds or their own development builds of Firefox.

Firefox’s JavaScript memory is segregated into compartments.  Roughly speaking, all memory used by JavaScript code that is from a particular origin (i.e. website) goes into its own compartment.  Firefox’s own JavaScript code also gets one or more compartments.  Compartments improve security and memory locality.

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.

 1950s B-movie woman screaming

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.

15 replies on “Zombie compartments! Recognize and report them. Stop the screaming.”

I can’t help but feel you’re really enjoying this.

First zombie compartments, then immortal zombie compartments, then what’s next? Vampire compartments?

Alex R: no vampire compartments, don’t be silly. Just more Zombie Compartments.

vampire compartments would be eaten up memory chunks from other compartments to survive. Hey, could happen.

I’m sorry, but linking to this blog post from the homepage is a terrible idea.

A lot of FireFox users (myself included) are complaining about its outrageous memory consumption. If Mozilla wants to improve on this, providing this kind of instruction to users is not the way.

The instructions here require above average technical skill and a lot of patience. You cannot expect “average Joe” users to follow any of this. I know I won’t and I’m a software developer!

It’s time to take this issue more seriously as Chrome is eating up FF market share. Mozilla needs to make a simple extension that transparently analyzes and reports memory leaks and “zombies” back to them. The data should be used to make memory management in FF super safe, even for add-ons.

Any by transparent I mean that once installed, this extension should require the user to do *nothing*. It should work automatically and not bother the users at all.

I hope someone’s listening because it’s getting harder and harder to defend FF’s sketchy memory and CPU performance in the face of Chrome’s superiority.

Kind Regards,
Uri Goldstein

I have been trying for a few weeks to find a way to send feed back and further details on the firefox web browser. There are a few features that I cannot find to turn on and if added could make the browser even more attractive. Where do I send such comments suggestions and code? This is the first site I found with a Reply area so maybe you can help.


Benjamin: is the place to go if you need help in general. Bug reports should go to

Its not just about getting memory consumed, is it? As far as I found out, without trying any codes, that the desore to add many features to FF os the glitch here. Lets say if yoi want to wear a suit, that has all the colors, you have to be a giant. Dont follow all features of others, that you come across, just add the essentials! As it is, FF is fantastic. The syncing of FFs and a mail-and-SocialNetworking could be a great reassurance. As of the addons, I recommend, have diferrent dosttos of FF and bundle and categorise addons accordingly. A lil-bit clouding will be awsome, eg for most viewed sites and a bulletin instead of search page, comtaoning most viewed and reviewed sites. Tabbed browsing opens a new process, so I have an idea you might be interested in! That will save memory, process consumption and speed up browsing aswell. Dp let me know if interested.

Well I had been using FF 7.x as my main web browser and happy to say it was very “stable” to be used full time .. have since updated to 8.x yes I am on the nightly channel… however 8.x tends to crash a lot more than 7.x …
I would indeed like to help out and test these new features.. opening fresh tabs with about:memory?verbose per site/page is bit of a pain… there must be a way to automate/semi automate this via scripts/shell ???

I am kinda new to all this but if some one is willing to mentor/give proper detail instructions I could help out with testing..

Platform Linux_64/KDE telemetery enabled, peref data enabled, crash reporting enabled, testing has been done with membuster and MemBench few times 🙂 Thanks

Monts: I don’t have a good answer to your question about scripting about:memory. Unfortunately about:memory is a “chrome” page, which means it has elevated privileges, and so Firefox doesn’t let you open it from normal JavaScript code. I just open it manually when I need to see it.

I will agree that I’ve been a Firefox lover since version 1.0, however, lately I’ve noticed that Firefox (I’m using 3.6.18 still) tends to use up progressively more memory the longer it stays open. Especially on websites like that is displaying weather animations on one of my tabs. Chrome seems to be immune to this, granted I have several Extensions installed on my Firefox that I don’t have on Chrome…

Prescott Linux: A couple of things you could try: (1) disable your add-ons selectively, to see if one (or more) are the cause. (2) Try Firefox 7 (currently on the aurora channel, which might help.

Comments are closed.