I read an exchange today about the memory usage of Firefox 7 (which is currently in beta).

It uses 600 MB of RAM with 10 tabs open (different websites). lol wut? I’m not getting the same results as you. I have 12 tabs open here… RAM usage rarely exceeded 300mb for me. That’s already much better than Chrome, which seems to be using 190mb for just 2 tabs. Memory consumption is around 300 MB for me too.

I’ve seen variants of this exchange countless times. Unfortunately, observations such as “browser X is using Y MB of memory with Z tabs open” are meaningless. To understand why, consider this alternative, hypothetical exchange:

I ran 3 different programs on my computer, they took 55 seconds to finish. lol wut? I just ran 8 programs and they only took 20 seconds to finish!

You’d never see an exchange like that, because it’s obvious that a comparison of the run-time of multiple programs is meaningless if you don’t specify what those programs are. Workload matters. And yet, people make comparisons of browser memory usage like this all the time.

Here’s a simple example to show why this isn’t meaningful. I just did some memory measurements with a development build of Firefox 9, using a moderately-used profile with no add-ons installed. First I started it and opened 10 instances of www.google.com.au, one per tab, and the resident set size (RSS) was 139MB. Then I re-started it and opened 10 instances of gmail.com, and the RSS climbed to 651MB.

This is hardly surprising. gmail.com is a fully-fledged email client. www.google.com.au is not much more than a search box.

Why do people so often make these meaningless “Y MB of memory with Z tabs open” comments? My theory is that it’s because most people have no idea how complicated web browsers and web pages are. Mild experience with HTML authoring is endemic — heaps of people have thrown together a basic web page, and it’s just a document with with some structure and styling, right? So they think the difference between the website they wrote for their scout troop in 1997 (the one with the “under construction” animated GIF) and the front page of TechCrunch is merely a difference of degree, not kind.

They’re wrong. For one, HTML and related technologies are hugely more powerful and complicated now than they were a few years ago. Also, their scout troop website probably didn’t contain multiple megabytes of JavaScript code tracking its visitors’ every move. A web browser is not a document viewer, it is a full-blown programming environment with some very sophisticated text and graphical capabilities. A web page is not a document but a program. Therefore, the memory (and CPU) usage of different web pages varies dramatically.

Here’s a check-list of information that you should include if you want an observation about browser memory usage to be meaningful.

What sites do you have open? The more specific, the better. E.g. “Gmail and a few nytimes.com pages” is ok, but listing the exact URLs is better.

How did the browser get in this state? Did you just start it, or have you been using it and visiting other sites for hours?

What memory metric are you using, and how did you measure it? “Explicit” from Firefox’s about:memory? “Private bytes” from the Windows Task Manager? “RSS” from “top” on Mac or Linux? (The full output of Firefox’s about:memory is hugely useful, because it includes dozens of highly relevant measurements.)

In Firefox, do you have any add-ons installed? That can (and often does) make a big difference. (And that’s a topic for another day.)

If you include all that, it’s highly likely that somebody else can reproduce your measurements, which means it’s a highly meaningful observation.

On a related note, I wrote previously about Firefox 7’s memory improvements, saying “Firefox 7 uses less memory than Firefox 6 (and 5 and 4): often 20% to 30% less, and sometimes as much as 50% less.” The presence of the words “often” and “sometimes” in that sentence were deliberate. We’ve seen those numbers in our testing, but once again, workload matters. I really hope the numbers we’ve seen match what normal users see. In fact, I thought that people would independently test these claims shortly after I wrote them. But, to my knowledge, that hasn’t happened so far, even though those claimed improvements have been reported far and wide. (I’ve even seen numerous headlines that say “Firefox 7 to use 50% less memory”, alas.) Maybe once Firefox 7 is officially released people will make independent measurements.

(A final note: suspicious readers may think that I’m trying to obliquely absolve Firefox from any responsibility for its memory usage by blaming web pages instead. I’m not. Firefox is doing much better now, but there’s still plenty of ways it can be improved; please contact me if you want to help.)