Mozilla developer ‘Pavlov’ wrote up some extensive details on memory use in Firefox 3. I highly recommend that you check it out.
I borrowed some of his data and created another view of the results. For example, here’s the results from Windows Vista of a number of browsers:
Note that both Safari 3 and IE 8 crashed during the test (which was a page runner which automatically opened and closed groups of web pages) so accurate numbers weren’t able to be achieved for them. Some preliminary numbers show Safari 3 on a similar path to IE 7 (Stuart mentioned that IE 8 showed a similar path, as well).
It’s great to see the massively-improved memory use of Firefox 3. It far excels anything that we offered, previously, and seems to best all other browsers on the platform.
Now, obviously, Windows Vista isn’t the only platform available. I, personally, use OS X and am interested to see the memory numbers there as well. One portion of Stuart’s blog post that I found to be particularly interesting was the discussion of measuring cross-platform browser memory use – and how difficult it can be. Here’s how he explains it:
The short summary is Windows Vista (Commit Size) and Linux (RSS) provide pretty accurate memory measurement numbers while Windows XP and MacOS X do not.
…
On Mac, If you look at Activity Monitor it will look like we’re using more memory than we actually are. Mac OS X has a similar, but different, problem to Windows XP. After extensive testing and confirmation from Apple employees we realized that there was no way for an allocator to give unused pages of memory back while keeping the address range reserved.. (You can unmap them and remap them, but that causes some race conditions and isn’t as performant.) There are APIs that claim to do it (both madvise() and msync()) but they don’t actually do anything. It does appear that pages mapped in that haven’t been written to won’t be accounted for in memory stats, but you’ve written to them they’re going to show as taking up space until you unmap them. Since allocators will reuse space, you generally won’t have that many pages mapped in that haven’t been written to. Our application can and will reuse the free pages, so you should see Firefox hit a peak number and generally not grow a lot higher than that.
I think it’s great to see these numbers come in. In many ways Firefox 3 is going to be a very different browser from its previous instantiations. I’ve, personally, been using it as my primary browser for a while now and have enjoyed the increased performance. It really does feel – and really even look – like a whole new browser.
If you’d like to try Firefox 3, especially without disturbing your current setup, it’s really easy – and I’ve even written up instructions to help you out.
David Naylor (March 13, 2008 at 3:06 am)
Nice graph! Would be even nicer though if it had nice round labels… i.e. 0 – 100 million – 200 million – 300 million – 400 million
John Resig (March 13, 2008 at 3:33 am)
@David: Good suggestion. I’ve adjusted the graph to go from 0-500 million bytes.
José Jeria (March 13, 2008 at 3:40 am)
What program do you use to generate those charts? They look great.
John Resig (March 13, 2008 at 3:41 am)
@José: Apple Keynote (the presentation software). I love how their charts look so I use it frequently for this purpose (I have a lot of one page slideshows on my hard drive, heh).
Jörn Zaefferer (March 13, 2008 at 5:16 am)
It would be much more fun to try out Firefox betas if they’d be released as standalone version, at least as an option. On Windows, its handy that the installer uses a different install location, but it doesn’t help at all when dealing with profiles.
Luckily there already is a portable version available. Works quite well, though you have to close running instances of Firefox first.
Philip Hofstetter (March 13, 2008 at 5:39 am)
what nobody seems to see behind this graph is all the bitching and moaning around that FF 2 was bloated as opposed to FF 1.5. There is a quite large bunch of self-proclaimed “experts” and trolls around who all stay at FF 1.5 because, they say, FF 2 is bloated and leaks memory – even more so than IE.
Now while we all see that FF 3 is a large improvement over FF2 and IE, this clearly shows that these trolls around better shut up right now as obviously, FF2 had a better memory profile than its predecessor and both of them were WAY better than IE.
Aside of that: Why would I conserve memory these days? Why is it better to have a 1mb application with 999mb of free ram as opposed to an 999mb application which is blazingly fast due to a lot of caching going on and 1mb of free ram?
Still: Congratulations on this new milestone, though I still fail to see the point.
Philip
boris (March 13, 2008 at 5:48 am)
Could you describe methodoly of your testing?
Uri Sharf (March 13, 2008 at 6:23 am)
My Impressions are that on OS X and Linux the progress is far less obvious. The Mac version is quite unpleasant to use when compared with the slickness and speed of Safari 3 or WebKit.
Mike Purvis (March 13, 2008 at 8:24 am)
My (totally unscientific) impression from using Webkit nightlies and FF3 B4 is that Safari tends to bias more toward low processor usage than low memory usage. I’m not sure if that’s actually the case or just a hallucination, but it would kind of make sense given that Apple sells a lot of laptops, and laptops running at high load eat their batteries and make a lot of noise.
CableGuy (March 13, 2008 at 9:00 am)
I have previously tried Beta release of IE8, Opera 9.50 and Safari in Windows, but none can compare with Firefox3 Beta4.c
René Stach (March 13, 2008 at 9:41 am)
If memory usage is an important issue, it should be possible to restrict the browser’s memory usage.
I did that in Opera 9.5 by restricting the memory cache from automatic to a size of 10MB (tools > preferences > advanced > history). Then I ran the test and observed the windows task manager (under Win XP) carefully. Although XP shows you the reserved memory (which is always higher than the used memory shown under Vista), Opera 9.5 never exceeded 195MB memory usage during the entire test.
To be able to compare my figures under XP with your graph of Vista I have run the same test in FF2 on my machine. Within the first 50 out of 319 pages, the memory usage jumped over 300MB and CPU usage was often close to 99% so I stopped the test after 100 cycles. So yes, I can confirm, XP figures seem to be much higher than Vista figures.
That is why i am wondering, how much Opera 9.5 would outperform FF3 on a Vista system following your test procedures when Opera’s memory cache is set to an ungreedy value like 10MB. Maybe you can perform another test on your system with Opera’s memory restricted?
René
timothy (March 13, 2008 at 9:43 am)
Windows users who want try try FF3b4, but want to keep FF2 as their main Firefox, can grab the portable version.
http://portableapps.com/apps/internet/firefox_portable/test
Wade Harrell (March 13, 2008 at 9:55 am)
i am not really sure if this speaks to the leaks over time issues in FF2. a frequent occurrence for me is to leave work for the day with several tabs open in firefox (lock the machine and walk away) by the next morning the machine is unusable until i shut down FF and let go of the memory it gobbled overnight. after going through this a few times i decided to open IE7 with the same number of tabs to the same sites and let them both go. next morning IE had the same memory usage as when i left it, but FF had spiraled out of control. i am now in the habit of restarting FF several times during a day and shutting it down at night, but it would be nice to not think about it.
Ash (March 13, 2008 at 10:06 am)
To try out Firefox betas I use the following steps:
1. Close all Firefox windows.
2. Install beta.
3. Open beta in safe mode ( anyway not much extensions works as of now).
4. When had enough of playing around close it and use Firefox 2
Only issue I faced is that Firefox 2 starts asking questions about secure sites again as those preferences gets reseted.
I am doing it since beta 1 and now beta 4, and hadn’t loosed anything till now.
Dinoboff (March 13, 2008 at 10:43 am)
I don’t believe in this graph. It’s 2 hours FF2 is open and it’s already using 360Mo. At the end of the day, I will have restarted FF2 at least once.
Also, I have a Chickenfoot script that repeatedly browse some pages and look at the content. Using it on FF2 / windows XP with 512Mo of ram, the computer start to become unusable after 10 minutes. On windows Vista with 2Go, it happens later, maybe 1 hour, when FF2 has eaten 1.5Go. On Linux, the script can run for hours without any memory leak.
timothy (March 13, 2008 at 10:55 am)
Since I run Safari, FF, IE, and Opera (and a few rare browsers) all the time, I have a terrible time with memory and spend all day rebooting. Can anyone suggest good tools for finding leaks in my JavaScript? I know there’s Drip 0.5 (is that the most recent) for IE. Anything else?
The way it SHOULD work is that it should be impossible for my JavaScript to leave any memory lying around after the page is navigated away from, but, obviously, the authors of the browsers are only human.
Roshan Bhattarai (March 13, 2008 at 11:32 am)
Wow that really cool chart..I’m waiting for the stable release of the Firefox 3.0. But when I use the Firefox and internet connection goes down while 10 tabs are opened then it crashed sometimes.I don’t know it the problem in my browser only or problem of all the Firefox browser.
David Naylor (March 13, 2008 at 12:47 pm)
You’ve been dugg:
http://digg.com/software/Firefox_3_pwns_Opera_9_5_beta_in_memory_usage
Stuart Parmenter (March 13, 2008 at 1:40 pm)
René: Certainly you can disable lots of caches in all browsers and get them down to smaller numbers. We ran the test with default settings so that you could easily compare them. If you disable things like the bfcache in firefox and drop the memory cache size down a bit it’ll be significantly smaller.
René Stach (March 13, 2008 at 2:06 pm)
Stuart: Right, but when you compare memory usage in terms of a performance indicator, you should configure browsers in a way that they do not make use of unnecessary caches. As far as I know, Opera’s cache is dynamic. I.e. it consumes more memory the more memory is available. Try it with 512MB RAM and the same test will produce significant different test results compared to a test with 2048MB RAM.
Regarding memory consumption, all caches should be turned off to get comparable figures. Only that way you can see how much memory is really necessary to load and display a page in a browser.
So my conclusion is: Repeat all tests with all caches turned off to really see how much memory a browser needs.
René
Stuart Parmenter (March 13, 2008 at 2:27 pm)
René: I’m sure all browsers use variable sized caches, but there are many caches there are no ways to disable (without changing code and recompiling). You can try to tune things all day long but I’m not sure you can really compare things as equally once you start changing prefs.
I’d be interested in seeing numbers, but I guess I’m not sure they have much meaning. End users aren’t going to tune their caches to get optimal results. The test is available on my blog to run, so if you’ve got some time feel free to get some numbers.
Stuart Parmenter (March 13, 2008 at 2:29 pm)
oh, looks like some guy ran with Opera with low cache settings:
http://blog.pavlov.net/2008/03/11/firefox-3-memory-usage/#comment-3082
see the graphs there.
Scott Johnson (March 13, 2008 at 3:29 pm)
I just grabbed a copy of Portable Firefox 3.0b4 today. I’ve been reading here about how much better it is, but now I’ve seen it for myself. John: the javascript optimizations are noticeable and very much appreciated. This thing flies!!
Dave Hyatt (March 13, 2008 at 4:05 pm)
Minor nitpick. You note that IE8 is a beta on the slide but not that Safari 3 is also a beta. Safari 3 on Win32 is still in beta and has not yet been officially released.
Asa Dotzler (March 13, 2008 at 10:43 pm)
Dave, is the underneath-the-app code in Safari 3 Beta (3.0.0.4) on Windows newer, older, or equivalent of a shipping Safari on Mac?
Ryan (March 25, 2008 at 3:37 am)
I can no longer use FF2 for day to day, it is such a dog after FF3 latest b4. Safari for windows is not bad either.