Mozilla Firefox Gets Major Memory Improvements

Martin Brinkmann
Jul 7, 2011
Updated • Mar 15, 2012

Memory usage has always been the Achilles' heel of the Firefox browser for part of the user base. Mozilla acknowledges that and is currently working on optimizing the browser's memory usage significantly.

One would normally assume that opening a tab increases memory usage, and that closing the same tab would drop memory utilization again to levels prior to opening that tab. That assumption up until now has not been true, which can be attributed largely to JavaScript fragmentation.

Firefox allocates 1 Megabyte chunks for the browser's JavaScript heap. These chunks are returned once they are completely empty of data that is used by the browser. The only problem until now was that chunks contained objects and elements from various processes, sites and browser features.

Gregor Wagner analyzed the behavior and noticed that about 30% of the 1 Megabyte chunks could not be deleted because of small files that were still in use in the chunks.

Wagner implemented a patch that separated long and short lived objects by "placing system and user objects into separate chunks". He defines long lived objects as browser elements that do not come from web pages. The core benefit of this approach is that chunks can be emptied a lot quicker which means that they can be returned to the operating system.

An improvement of about 30% was noticed on average on patched versions of the firefox web browser.

Closing all tabs after surfing:

  • 108,003,328 B — js-gc-heap (without patch)
  • 20,971,520 B — js-gc-heap (with patch)

Memory footprint of the whole browser:

  • 310,890,496 B — resident (without patch)
  • 219,856,896 B — resident (with patch)

That's an impressive improvement which will likely make its way into the upcoming Firefox 7 browser.

Nicholas Nethercote posted a summary of Firefox memory improvements on his Mozilla based blog which includes information about George Wagner's optmizations, but also information about other parts of the browser that get optimized.

Firefox users can look forward to the next but one version of the browser that ships with all those improvements. In related news, the first Firefox 8 Nightlies have been spotted on the Mozilla server.


Tutorials & Tips

Previous Post: «
Next Post: «


  1. tbvnz said on July 10, 2011 at 3:36 pm

    I use Firefox 3.6 with 40+ addons along with Stylish(40+ user styles). I’ve
    been using the Minimem memory management application by Kerkia and use
    around 80k – 150k with 10 tabs open and around 15k – 30k with 1 or 2 open.

  2. Gabo Lugo said on July 7, 2011 at 9:27 pm

    About time.

  3. Antonio said on July 7, 2011 at 1:47 pm

    This is only a part of the problem. The ram usage increases endlessly even if I do not open any tab. It increases even if I do nothing at all.

    1. Phillip said on July 7, 2011 at 3:13 pm

      Sounds like its an addon problem. At home I use 25-35 tabs 24/7 and only restart firefox about once a week when I reboot and it generally stays between 550-650MB of ram.

      1. pd said on July 9, 2011 at 4:55 pm

        Unfortunately Nicholas Nethercote says that disclosing Add-On memory usage is something that they really have no idea how to do:

        “measuring add-on memory consumption is hard, unfortunately. Firefox lets add-ons hook their claws in so deeply it’s difficult to know where Firefox ends and the add-on starts. I wish I knew a way to do it, because it would render the “are you running add-ons? have you disabled them?” routine moot.”

      2. Martin Brinkmann said on July 9, 2011 at 5:19 pm

        How about some tests with the add-on enabled and disabled to find out?

      3. boris said on July 8, 2011 at 2:03 am

        That is too much RAM for normal use. My Firefox slows to crawl above 600MB Ram. Thankfully I stay under 12 tabs and do not have to restart Firefox more than once a day(on normal day)

  4. JohnBoy said on July 7, 2011 at 1:23 pm

    “Firefox users can look forward to the next but one version of the browser that ships with all those improvements”

    i don’t understand what this says. Please elaborate

    1. Martin Brinkmann said on July 7, 2011 at 1:24 pm

      Will not be available in Firefox 6, but in Firefox 7.

      1. pd said on July 9, 2011 at 4:58 pm

        You can always try Aurora 70.0a2 which Nicholas Nethercote confirms is the first semi-stable release to get this new memory management code:

  5. Paul(us) said on July 7, 2011 at 12:24 pm

    Really great news, Do you think that the add-on memory fox (and look a likes) are still needed, to let the memory consumption go down quickly?

    1. Martin Brinkmann said on July 7, 2011 at 12:54 pm

      I’d say they become less effective.

      1. nick said on July 7, 2011 at 9:26 pm

        Is this a typo: Firefox users can look forward to the next but one version of the browser that ships with all those improvements.

        I don’t understand “forward to the next but one version”

  6. Mehdi S said on July 7, 2011 at 12:19 pm

    The Toms Hardware WBGP 5 is out….Firefox cannot still compete with IE and Chrome in terms of memory management. It gets totally destroyed…
    Link below,2976-10.html

    1. pd said on July 9, 2011 at 5:02 pm

      What are you talking about? That site has Firefox second best when it comes to memory use for 40 tabs:

  7. anaklein said on July 7, 2011 at 12:19 pm

    thats was very needed

Leave a Reply

Check the box to consent to your data being stored in line with the guidelines set out in our privacy policy

We love comments and welcome thoughtful and civilized discussion. Rudeness and personal attacks will not be tolerated. Please stay on-topic.
Please note that your comment may not appear immediately after you post it.