Major memory improvements coming to Firefox 15

Martin Brinkmann
Jul 19, 2012
Updated • Jul 19, 2012
Firefox
|
17

Firefox 15 stable will be released in about six weeks and it will bring with it major memory improvements that could once and for all do away with the browser's memory hog image. We have shown previously that Firefox's memory utilization has improved significantly in recent versions of the browser (see Chrome uses way more memory than Firefox, Opera or Internet Explorer), and that the browser's image of being memory inefficient is more a thing of the past than it is something that many users complain these days about.

But things are getting even better when Firefox 15 gets released. Users of the beta, aurora or nightly channel are already benefiting from the improvements. Mozilla basically found a way to plug add-on memory leaks in the browser which were often responsible for the memory increase over time.

Firefox now attempts to clean up after leaky chrome code.  My approach takes advantage of the fact that chrome code lives in a separate compartment from web page code.  This means that every reference from chrome code to content code goes through a cross-compartment wrapper, which we maintain in a list.  When the page is navigated, or a tab is closed, we reach into chrome compartment and grab this list.  We go through this list and “cut” all of the wrappers that point to objects in the page we’re getting rid of.  The garbage collector can then reclaim the memory used by the page that is now gone.

Memory leaks have been found in all kind of add-ons, including the four most popular add-ons for the browser: Adblock Plus, Video DownloadHelper, Greasemonkey and Firebug.

Take a look at the following chart that shows the difference quite clearly. The blue bar shows the browser's memory usage with 151 tabs open, the red bar the same browser's memory utilization once 150 tabs have been closed again.

firefox memory consumption

In this case, the memory leaking add-on sideAdvisor 3.41 was causing the browser to use way more memory after closing the tabs than it should have been using. With Firefox 15, the usage dropped significantly despite the memory leaking add-on.

Not every Firefox user may see those improvements. If you do not use a single add-on for instance, you won't see improvements at all. But who in their right mind uses Firefox without add-ons? Read more about the changes at Nicholas Nethercoate's Mozilla blog.

Are you working with Firefox? If so, what is your take on recent developments in regards to performance?

Advertisement

Tutorials & Tips


Previous Post: «
Next Post: «

Comments

  1. Peter Wills said on August 11, 2012 at 2:08 am
    Reply
  2. Peter Wills said on August 11, 2012 at 1:50 am
    Reply

    The problem with K-Meleon is the lack of useable extensions and add ons support . My point was to illustrate that the issue is more to do with FF than anything else. It’s nice that they can now plug memory leaks due to add ons but if they can do that then why can’t they achieve the same with their own product?

  3. Peter Wills said on August 11, 2012 at 1:43 am
    Reply

    Realistically, who has 150+ tabs open at any one time?

    And the problem IS with FF. There was a very interesting article I read some time ago which explained how the coding used in FF is basically responsible for the memory issues. If I can find that article again I will post it here. I have run FF with no add ons and as little as two add ons and it still uses ridiculous amounts of memory.

    If anyone is interested, download and install the latest version of the K-Meleon browser which has consistently been one of the fastest browsers on the planet for a long while now and also VERY lean on memory use, yet it uses the same gecko engine which until recently FF used to use

  4. Peter Wills said on August 11, 2012 at 1:22 am
    Reply

    Not before time. FF has been a ravenous beast memory wise since V2! It will be interesting to see if the final release of V15 does significantly fix the issue. I am not holding my breath!

  5. Gonzo said on July 22, 2012 at 5:34 am
    Reply

    I’ve had FF 14.01 open for ~4 hours and currently have 10 tabs open. I’ve opened and closed numerous tabs during this time. I have 7 extensions and 2 plugins enabled.

    Total memory in use by FF is ~250MB using Win7 x64.

    I also have an OLD laptop (circa 2003) running Lubuntu and have found FF is better with memory than Chromium.

    FWIW these are real world observations from a very aware user.

  6. TopQuark said on July 20, 2012 at 2:08 am
    Reply

    Why did it took up to version 15 to fix it? This should have been done since version 2!

    Should I now, finally, switch back from Opera to Firefox? I hope it is not too late because Opera is rockin’.

  7. Yoav said on July 19, 2012 at 10:18 pm
    Reply

    Well, I’ll believe when I see it…

  8. RSWRC said on July 19, 2012 at 9:51 pm
    Reply

    Your use case is nice. But i my use case it probably wont help:
    I have all the time opened gmail, greader, gcalendar and facebook. When i look at about:memory i see that half of my RAM used is by JS comaprments from Google and Facebook. Of this two google is using 90%. Generally now:

    185.51 MB (100.0%) — explicit
    ├───98.79 MB (53.25%) ++ js
    ├───27.12 MB (14.62%) ── heap-unclassified
    ├───24.09 MB (12.98%) ++ window-objects
    ├───12.92 MB (06.97%) ── spell-check
    ├───12.80 MB (06.90%) ++ storage
    ├────5.66 MB (03.05%) ++ images
    └────4.13 MB (02.23%) ++ (8 tiny)

    I think i wont see a significant change to what i have now.

    1. RSWRC said on July 20, 2012 at 1:20 pm
      Reply

      FF15b1 installed and like i suspected no memory improvements visible.

  9. RG said on July 19, 2012 at 9:34 pm
    Reply

    I have spent the majority of last 2 years running two up to date versions (one portable, one FF profile with only 2 add-ons adblock, Firebug) While I do see memory improvements they are marginal and in the relative absence of add-ons and (my) anecdotal evidence I think the major blame lies with FF itself and flash.

  10. marius said on July 19, 2012 at 8:57 pm
    Reply

    I’m a Firefox fanboy,and Firefox 14.0.1,wasn’t a smooth upgrade,but I’m willing to forgive,cause Firefox is still the best and it improves with every version!Every new version of Firefox,I care,Google Chrome…they still have versions?

  11. bastik said on July 19, 2012 at 8:12 pm
    Reply

    Maybe they shouldn’t have announced the “final end”. Things got improved over time. This looks like an improvement, too.

    1. Fine citizen said on July 19, 2012 at 8:21 pm
      Reply

      I hear you man.. ‘and another final end this week..’

  12. Bee.GH said on July 19, 2012 at 7:24 pm
    Reply

    How many times now has Mozilla made major changes that will finally end the memory issues with Firefox?

    1. Martin Brinkmann said on July 19, 2012 at 7:36 pm
      Reply

      Well I’m seeing major improvement, you do not?

      1. JohnMWhite said on July 20, 2012 at 5:22 am
        Reply

        I’ve seen lots of graphs showing major improvements in Firefox’s memory management. I’ve not seen those results bear out in the real world so much. I still love FF, but the memory leaks have dogged it for years. I was still running Windows 2000 the first time they ‘fixed’ Firefox’s memory problems.

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.