ghacks Technology News

Mozilla Firefox Gets Major Memory Improvements

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.

Enjoyed the article?: Then sign-up for our free newsletter or RSS feed to kick off your day with the latest technology news and tips, or share the article with your friends and contacts on Facebook or Twitter.

Related Articles:

Firefox 7 Aurora Shows Significant Memory Usage Improvements
Memory Fox Flushes Firefox’s Memory Constantly
Mozilla Firefox Will Become More Memory Efficient
Firefox 5 Gets Faster Connections, Up Next: Memory Improvements
Automatically Restart Firefox On High Memory Usage



About the Author:Martin Brinkmann is a journalist from Germany who founded Ghacks Technology News Back in 2005. He is passionate about all things tech and knows the Internet and computers like the back of his hand. You can follow Martin on Facebook or Twitter.

Author: , Thursday July 7, 2011 -
Tags:, , , ,


Responses so far:

  1. anaklein says:

    thats was very needed

  2. Mehdi S says:

    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

    http://www.tomshardware.com/reviews/opera-firefox-chrome,2976-10.html

    • pd says:

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

      http://media.bestofmicro.com/K/T/298829/original/memuse40tabswbgp5.png

  3. Paul(us) says:

    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?

  4. JohnBoy says:

    “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

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

      • pd says:

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

        http://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/latest-mozilla-aurora/

  5. Antonio says:

    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.

    • Phillip says:

      Antonio
      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.

      • boris says:

        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)

      • pd says:

        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.”

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

  6. Gabo Lugo says:

    About time.

  7. tbvnz says:

    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.

Leave a Reply   Follow Ghacks   Subscribe To Comment Rss

Subscribe without commenting

© 2005-2012 Ghacks.net. All Rights Reserved. Privacy Policy - About Us