Just Say No: Archives

I eat Wheetos for breakfast. Firefox prefers to gorge on RAM, all day.

Sam Phillips, November 4th, 2007 11:35 pm

To me, Firefox is a pretty near perfect piece of software; in fact I only have 2 major gripes with it. Firstly, you can only ever open one session at a time. Sure you can open multiple instances, multiple tabs, whatever, but these instances will always share cookies, sessions and ghost stories. There’s no way, yet, of sorting this out, which makes development a pain. Want to be logged into the same website as two different users? Time to boot up Internet Explorer.

Gripe number 2 is Firefox’s memory usage. Firefox looks at your system’s memory like Ronnie Biggs looks at a bag of money, and after only a couple of hours, it’s not uncommon to find that everyone’s favourite browser is using over a 100 meg of memory. If you leave your pc on overnight, as I did last night to get some downloads finished, and happen to leave Firefox open, doing nothing, expect to find it using up to 300 meg in the morning. Frankly, it sucks, and I seem to spend my life opening and closing browser windows just to keep them functional.

To put this problem in context, I feel it should be pointed out that internet browsers are usually the most demanding software packages running on my PC. Google Desktop is mostly tame and under control nowadays. Explorer (as in the Windows kernel) uses less than half your average, brand new, browser instance. MSN Messenger uses only just less memory than the kernel (bloatware tastic), and as I ran the tests below, I had Excel open to collate the results. Even this hefty program was using less than my web browsers, by some margin. I say this to emphasise that my system is hardly under stress; yet still rendering web pages with Firefox seems to be problem.

I’m not convinced that upgrading to version 2.0.0.9 has helped matters either; memory usage now seems worse than ever. This morning I decided to run some tests, side by side with Internet Explorer 7 (version 7.0.5730.11), over what I considered to be a fair sample of sites. I visit them all regularly and have chosen them because of their different technologies and function. For each test, new instances of IE and FF were opened, the relevant page was accessed (including any logins) and then the counter was started. I recorded the memory usage (in KB) every 2 minutes for 10 minutes for both browsers. Here are the results:

BBC News

BBC News is my homepage, and was 10 years old this week. It features biased and smug news reporting, a penchant for spelling, grammatical and factual errors (especially at the weekend) and some really quite terrible JavaScript red box things in the middle. Once it is loaded (88 requests later), it makes no further http requests. This doesn’t stop Firefox from continuing to eat up memory, however:

Minutes 0 2 4 6 8 10
Firefox: 47,136 47,732 50,744 51,088 52,236 52,232
Internet Explorer: 44,092 43,992 43,996 43,976 43,976 43,976

Ouch. As you can see, Firefox’s memory usage over the course of the test increases by 5096KB. Internet Explorer, on the other hand, has a pretty stable consumption, and actually decreases over the time period. Bear in mind that once this page is loaded, there is nothing else to do. Exactly what does Firefox need another 5 meg of memory for, then?

Facebook Homepage

Weighing in at 105 requests for the initial load, the internal Facebook homepage (the one where you see people you barely know leaving 10 groups at at time and adverts for Experian’s credit reporting), is a beast - especially when you remember that it is little more than text that is displayed. No matter for Firefox, though - it will use memory whatever the situation:

Minutes 0 2 4 6 8 10
Firefox: 58,256 61,554 61,620 61,554 61,558 61,776
Internet Explorer: 60,524 60,300 60,292 60,276 60,276 60,252

Again, IE is stable. FF is poor. What’s more, during this test FF was also constantly using between 1 and 6% CPU - presumably because of the flash-based advert served on the left hand side. IE rendered a similar advert but used 0% CPU.

Gmail

I fully expected Gmail to really humiliate Firefox. It does almost 2 requests a minute; meaning that at minute zero it had completed 65 requests, and by minute 10 that number was 82. After examining the size of these requests, however, I could see that the files returned were often around the 26b mark. This is of course the server checking for new mail and sending back a ‘no new mail’ message (well, an empty JSON array or something similar). 2 requests a minute, for ten minutes, that return tiny files? That’s nothing that Firefox can’t handle, providing you can grease its palm with another 5 mb of memory:

Minutes 0 2 4 6 8 10
Firefox: 62,708 64,764 64,972 65,040 66,096 67,128
Internet Explorer: 61,372 61,400 61,416 61,352 61,588 61,628

It’s almost as if it doesn’t matter what website you look at; Firefox always wants more. IE is fine, and will sit there for days without bringing your system to a halt.

Martiny

I decided to take a different tack, and to try a much simpler site. Martiny is the homepage of Kristen Mason, someone I used to occasionally email and chat with on forums. Her site is sparse and, well, pretty random to someone who doesn’t know about, well, whatever it is she is talking about. With only one request to load the page, and with no images, CSS, JavaScript, our browsers had a pretty easy time of it:

Minutes 0 2 4 6 8 10
Firefox: 47,548 47,644 47,588 47,592 47,740 47,728
Internet Explorer: 42,528 42,336 42,336 42,796 42,796 42,796

Apparently both FF and IE needed an extra 200kb of memory to continue rendering this page for 10 minutes. Perhaps they were being cocky and booted up solitaire in the background for a quick game, thus using the remaining memory. Who knows.

Sam’s World Of No

It seemed only fair to test my own site as well. I’m a simple guy, I like simple pleasures and 20 requests is enough for my site to display a blog, some images I hacked together in not very many minutes, and to integrate with a couple of external services. Still, Firefox demands 400k to keep the lights on for 10 minutes.

Minutes 0 2 4 6 8 10
Firefox: 48,348 48,804 48,820 48,816 48,784 48,784
Internet Explorer: 44,004 43,728 43,728 43,704 43,704 43,656

Sucks to be me.

I am not saying that IE is better than FF. Patently, it isn’t. Even without firebug, which is the Firefox killer app, Mozilla’s browser is nicer, more user-friendly and generally easier to use than IE. I am prepared to give Firefox more memory as it is better and does more. What annoys me is the increasing memory usage, which isn’t immediately explainable. I’m not a win32 programmer, but if IE doesn’t need more memory, why does Firefox?

The only conclusions I can draw is that, for some reason, Firefox is using up memory. Over the next few days I will be attempting various suggested remedies (including disabling the Google Firefox Toolbar, ironically enough) and I’ll try to keep you posted. If anybody has any suggestions, please let me know.

(Writing this post took 30 minutes or so. Firefox is now using 117,060k of memory and about 5% CPU. Almost constantly. Ouch.)

(I’ve now proofed for 5 minutes. Firefox is now up to 134,024k.)

3 Comments:

  1. I’m interested in your methodology on this - were the browsers run “clean” with no addons/toolbars etc. (beyond those required for certain sites, eg. flash)? I assumed you cleared cache & cookies. Were these trials repeated and averaged? Were trials done side-by-side or in consecutive instances?

    I remember Firefox used to have some terrible memory leak problems, I wonder if the indescrepencies you describe are a hold-over from whatever’s been done to fix that.

    Have to say, as the relentless Microsoft apologist I am, that I find IE to have superior usability as subjective as that is.

    Comment by Pete — November 5th, 2007 @ 12:29 pm
  2. Methodology was shaky - as mentioned, I have Google Toolbar running the whole time which must make some difference, apart from that all other plugins are disabled (apart from things like dictionary, which wouldn’t have been doing anything as I wasn’t typing). Cookies and cache weren’t cleared (it was the increase in mem usage, not the overall usage that concerned me).

    I find IE to be a pain in the ass and Firefox generally to be friendlier; but that is a subjective thing as you say. In terms of web development, there is no alternative to Firefox because of its superior tools for developers, and closer adherence to standards etc. We design for Firefox first and mend in other browsers second - it’s definitely the quickest way to write XHTML.

    Anyway, these were just preliminary investigations - the real juice will be if I find any solutions!

    Comment by Sam — November 5th, 2007 @ 8:11 pm
  3. This is very interesting. As I type this comment with only this page open Firefox is using 5-13% and 108,744k

    I can’t seem to get it to sit a 0% it always wants to sit around the 2-5% mark, maybe that’s my FoxAmp sitting at the bottom doing nothing but checking to see if Winamp is loaded, who knows.

    Let us all know if you find any solutions.

    Comment by Rob — November 8th, 2007 @ 1:01 am

Leave a comment

Subscribe to this blog's RSS feed

On Twitter:

  1. Loading...

Follow me >

Previously Rejected:

  1. Ten products that Apple just rendered obsolete with iPhone 3G/2.0
  2. Professional Accreditation for Web Professionals (Or, a rant on the British Computer Society)
  3. If it’s that important… pick up the phone!
  4. Moving Google Mail, Calendar, Reader and Talk into Google Apps
  5. I’m sure the makers of BBC iPlayer have been waiting for me to say this…
  6. MacBook Pro vs MacBook Air
  7. The BBC’s rote teaching techniques
  8. Five reasons why you should use SVN for one-man projects
  9. The only limit to identity theft is the thieves themselves
  10. BBC iPlayer: the return of ‘beta’
  11. I eat Wheetos for breakfast. Firefox prefers to gorge on RAM, all day.
  12. Images and subjective influence in online news
  13. Ten Comments on the A List Apart 2007 Web Design Survey
  14. Television is not real; keep it that way.
  15. Radiohead and In Rainbows: Not free, not new.
  1. Bookmarks:

Valid XHTML 1.0 Transitional Valid CSS!