Slashdot Mirror


Notes On Reducing Firefox's Memory Consumption

Skuto writes "At yesterdays linux.conf.au Browser miniconference in Ballarat, Australia, Mozilla engineer Nicholas Nethercote gave a detailed presentation about the history of Firefox's memory consumption. The 37 slides-with-notes explain in gritty detail what caused Firefox 4's memory usage to be higher than expected, how many leaks and accidental memory use bugs were tracked down with Valgrind plugins, as well as the pitfalls of common memory allocation strategies. Current work is now focused on reducing the memory usage of popular add-ons such as AdBlock, GreaseMonkey and Firebug. Required reading for people working on large software projects, or those who missed that Firefox is now one of the most memory-efficient browsers in heavy usage."

16 of 297 comments (clear)

  1. Firefox is required anyway. by Tsingi · · Score: 5, Interesting

    I use other browsers for development, but only Firefox to browse, it's the only browser that I feel is actively protecting my privacy.

    Any other opinions on that?

    1. Re:Firefox is required anyway. by stms · · Score: 5, Insightful

      I use firefox because my plugins make the web a much nicer place to be.

    2. Re:Firefox is required anyway. by TheRaven64 · · Score: 4, Insightful

      I don't see your on-topic post. I see an article about software engineering techniques used to reduce memory consumption, with FireFox used as a case study. You then post about how FireFox protects your privacy. This is about as on-topic as a post saying that you use Android because you prefer the user interface in an article about a new feature in the Linux kernel improving battery life on ARM.

      --
      I am TheRaven on Soylent News
    3. Re:Firefox is required anyway. by Ihmhi · · Score: 4, Insightful

      Agreed. IE is shit, and I don't trust Chrome.

      I know it might be judged as paranoid and irrational (and to a degree, it is), but I really want the bare minimum of Google products on my computer. I just don't trust them. I've seen too many previously "good" companies abuse their power once their product is entrenched on everyone's computer, and I don't want to give Google much of a chance in that respect.

      Firefox isn't only the best for my needs, it's also the least of all evils that has the features I want.

  2. Give us more options by Anonymous Coward · · Score: 5, Insightful

    I have 8gb of memory on my main computer. I want firefox to use up as much of it as it can to improve my browsing experience. On my netbook, I have 1, I want it to sip as little as it can. There should be an easy way to tell the browser how much memory I want used for certain tasks such as caching and whatnot. Addons should have their own seperate allocation, and each individual addon should be configurable for how much memory it can use.

    Free / Open source software is about choices to run things how you want to. With that said, I don't have much room to complain because I've never contributed code to FF.

    My main point though, is that screaming "THE RAM USAGE IS TOO HIGH" is not effective. I have a lot of ram, and I want it to be used, just not wasted; and I want more control over it.

    1. Re:Give us more options by hedwards · · Score: 5, Interesting

      250ish MB or RAM is hardly unreasonable and is significantly better than the alternatives. If you don't like the RAM use with Firefox then you sure as hell aren't going to be happy with the competition. I haven't seen a benchmark or other comparison in a long time where Firefox didn't trounce the competition by a significant margin.

      TFA does raise an important point that the memory consumption problems are mostly with certain add ons. The vanilla install itself doesn't have those issues.

    2. Re:Give us more options by Seumas · · Score: 5, Insightful

      I have a lot of RAM, too. And Firefox runs like shit. It has for years and I've constantly heard the response of "no, you don't understand! it's just how it handles its back button function! That's why it uses two or three gigabytes!". I have 16gb on my primary system, so it can certainly use a few gigs if it really wants to. The question is - does it need to? More importantly, how does it perform when it's using so much RAM? That is the real problem.

      For years, I have put up with the experience of Firefox slowly grinding to a crawl. Within hours (certainly within a day at the most), it reaches 2.5gb or more memory usage and becomes unusable. Almost every action - typing, scrolling, clicking a button, entering a URL, clicking a link - causes it to hang temporarily. Sometimes for almost a minute. Click a tab. Hang. Scroll to the bottom of the page. Hang. Type in the text box. Hang. Submit. Hang. Close tab. Hang. Terrible experience.

      And, I stuck with it. Restarting the browser every few hours just became part of the experience (starting around early 3x, I believe). I primarily stuck with it, because I love Firefox and have used it forever. And Mozilla before that. And Netscape before that. Part of that is that I cut my teeth as an engineer at Netscape when I was young. It was my first real job. So I had a particular affinity for it, always. Besides, eventually they'd fix the issues. Even though they went forever claiming there weren't any memory issues . . . until sometime recently (last year, I think?) when there finally seemed to be acknowledgement of it.

      Most of all, I like having the access to extensions. Primarily, adblocking extensions. And then the tree tabs extension. And then panorama/tab candy was built into 4x. I tried Chrome several times, but their shitty handling of many tabs was terrible. I couldn't tolerate it. Firefox did it beautifully.

      And then, I finally got fed up. After all those years and all the delaying and all the excuses I made for Firefox, I decided a couple months ago that I would go full time Chrome and just see what it was really like. The result? I'm sold on Chrome, now. I can't believe I'm saying this, but I am. I never have to restart due to it behaving slow. I never have to restart due to it using too many resources. I never have it beach-balling for a minute at a time for every action I do. I never have Windows telling me the application has stopped responding. It just works.

      And here's the thing. It uses just as many resources, sometimes. Just like Firefox, I sometimes find it using as much as 3gb of memory. But where Firefox would start grinding to a halt around 1.5-2.5gb of usage, Chrome just keeps smoothly chugging along under as much as 3gb (and possibly more, but it never has used more than that, so I don't know).

      So, we can make all the excuses we want for Firefox. When it comes down to it, what matters is that my browsing habits cause Firefox to perform fucking terribly, while Chrome doesn't flinch. And when it comes down to my time and sanity, I need performance; not excuses.

    3. Re:Give us more options by TheRaven64 · · Score: 5, Informative

      I want firefox to use up as much of it as it can to improve my browsing experience

      RTFA. When FireFox has an off-by-one error in its JavaScript string concatenation code that causes it to allocate twice as much memory as it needs for JavaScript strings, it's not using memory to improve your browsing experience, it's just using memory. When FireFox is storing decompressed images in memory that never actually make it to the screen, it's not using memory to improve your browsing experience, it's just using memory.

      Most of the techniques in TFA were of general interest to anyone working on a large project, not just to FireFox.

      --
      I am TheRaven on Soylent News
  3. Firefox's problem by TheLink · · Score: 5, Insightful

    In my experience Firefox (minus plugins etc) has leaked/used less memory than Google Chrome.

    BUT, when a plugin/page starts leaking lots of memory the difference is with Google Chrome you can close the offending tab/window and the memory is freed up. You don't lose your sessions, don't lose your place on other tabs/windows. You can even reopen the page (esp if the page just slowly uses more and more memory).

    In contrast with Firefox you often have to close the entire browser to free up the memory. And IMO that's Firefox's biggest problem when it comes to memory.

    It doesn't matter how much better Firefox is on its own at memory management, in practice many people using Firefox are using it because of the plugins (otherwise they'd be using some other browser), and the plugin developers may not be so good at memory management.

    --
    1. Re:Firefox's problem by olau · · Score: 4, Informative

      It doesn't matter how much better Firefox is on its own at memory management, in practice many people using Firefox are using it because of the plugins (otherwise they'd be using some other browser), and the plugin developers may not be so good at memory management.

      Actually, the presentation addressed that. They're going to add a notice to known bad add-ons at the Mozilla add-on page (social engineering), and also add a basic leak test to things done by the reviewers.

  4. Re:misslabeled linke by Tsingi · · Score: 4, Informative

    The final link actually shows Firefox is one of the most memory inefficient browsers in heavy usage.

    That depends on how you look at it. With one tab open it is comparatively poor, but with 40 tabs open it's very good.

    I don't particularly think FFX has even close to the best performance, but those metrics are good. What's more important, good management with a low footprint or a high one? I have to disagree with you there.

  5. Re:i'll do my own tests by Anonymous Coward · · Score: 5, Insightful

    Yeah, most of the improvements were in the last 4-6 months.

    Anyone else get tired of this... "blah blah, my favourite open source browser wasn't competitive with the commercial product by an ad agency that records every keystroke I type in the URL bar a long time ago, possibly due to some addons I was running, so I just completely gave up on it and whenever a story comes up on how it has improved, I just state how it sucked at some time in the past and I'll never try it again"?

  6. More configurable, better plugins. by guidryp · · Score: 4, Insightful

    I use FF because it is much more configurable (about:config has entries for more than any other browser), it also has more plug ins, and those plug ins it does have tend to be more effective for just about everything.

    I also don't like Google Chrome calling home all the time (uninstalled). I also have IE9 and Opera installed.

    Speed issues are moot outside of benchmarks these days (unless you are running IE7 on a netbook). IMO it is pure placebo effect to say one browser is faster than another in regular browsing on a modern computer.

  7. Pale Moon browser by kriston · · Score: 4, Interesting

    Windows users should investigate the Pale Moon browser over at www.palemoon.org. Firefox optimized and without all the gunk.

    --

    Kriston

  8. Re:i'll do my own tests by Thud457 · · Score: 4, Funny

    with over 340 open tabs

    I think it's time for PybusJ to admit he has a pr0n problem...

    --

    the preceding comment is my own and in no way reflects the opinion of the Joint Chiefs of Staff

  9. Re:Memory leaks are easy by BZ · · Score: 4, Interesting

    You should read the article, which actually touches on this. One issue is that a "memory leak" can include memory that does in fact get released at shutdown, especially in garbage-collected systems (not a problem in C, of course).

    So you can have situations where you close a tab but its memory is kept alive for a while because an extension is referencing it. Not a leak in the C sense, but a leak in the sense the user cares about.