Enterprise Software

Just how much memory is Firefox using?

According to our logs 40% of you use Firefox: can you tell how much memory it's using? Here's a few tricks you should know if you're trying to cut it down to size.

It's a fact of life that whatever you do in I.T. chances are you'll be spending a fair chunk of your day in the browser - checking your email, browsing for technical info, checking your email, scanning the top stories on digg or slashdot and checking your email.

The tool of choice for many (just over 40% of you, according to our logs) is Mozilla's Firefox browser, variously because it's free, it's open source and it's got a fantastic selection of plugins. But after another day of my system grinding to an unceremonious halt at about 4pm, my patience finally reached the end of it's chain. For those of you without the pleasure of everyday firefox usage, the following is a screenshot of exactly what firefox is doing to my computer (image not to scale):

But how much memory is actually being consumed? If you're running firefox right now you can see for yourself how big the cache is by typing about:cache into your address bar. The first thing you'll probably notice if you've been browsing around a bit today is that the storage in use is actually bigger than the maximum storage size, which is an encouraging sign.

Memory cache device

Number of entries: 598
Maximum storage size: 9216 KiB
Storage in use: 14799 KiB
Inactive storage: 0 KiB

You can click the "List Cache Entries" link if you want more info. My one lists the memory cache usage at 15 megabytes after an hour of usage, which is hardly enough to worry a pc these days, but of course, the cache is just one chapter in the multi-part mystery thriller "The great RAM robbery".

If you're firefox savvy enough to be using a development version, then you can also visit the about:bloat page, which has much more detailed BloatView statistics. This info is disabled on public builds of the browser though.

As usual, if you're using windows you'll need to mess around with our good friend the task manager to find out what resources a program is claiming, but if you're running a UNIX derivative (Linux or Mac) then you can just run the following:

nickg@nickg-desktop:~$ ps aux | egrep -i "(USER|firefox)"
nickg 12424 6.1 47.0 287232 120460 ? Sl 09:25 8:00 /usr/lib/firefox/firefox-bin

Firefox is taking almost half of my available memory, and sure, I've got 3 windows and 14 tabs open, but 290 megabytes of virtual memory seems just a little higher than ideal at this point.

Enough griping, what can we do about it?

Browsing around a bit turns up three suggestions: 1. disable plugins and extensions and run in Safe Mode, 2. tweak the cache memory settings, and 3. my personal favourite - shut down all your Firefox windows and restart, bringing back, to me at least, a wave of nostalgia to the carefree days of Windows 95 reboots.

Let's concentrate on the one we can influence, tweaking the cache memory settings. There are three important settings to consider, all of which can be changed on the about:config special page:

  • browser.cache.memory.capacity - How much of Firefox's cache should be in memory. You can set this to any value you like, I've got 256 megabytes of ram in this machine, so Mozilla recommends I set this to 10240 or 10 megabytes of RAM. Let's try half that...

  • browser.sessionhistory.max_total_viewers - Firefox stores an amount of pages in it's back/forward buffer, to speed up moving through your recent history. The problem lies in that it will store up to 8 pages of history for every tab you have open. For my 14 tabs, this could be 112 pages of full text and images. You can set this to a saner value, or set it to 0 to remove it entirely.

  • config.trim_on_minimize - This one will only work on Windows, and affects whether the operating system is allowed to reclaim memory when Firefox is minimised. Pros: More memory when you're not using your browser. Cons: Firefox takes longer to maximise. Up to you which you want more.

Okay, I've set those to their minimum, and I'm restarting Firefox in safe mode. Open up a standard bunch of tabs and... Fingers crossed:

nickg@nickg-desktop:~$ ps aux | egrep -i "(USER|firefox)"
nickg 13499 29.0 42.9 304360 109848 pts/5 SLl+ 12:12 0:33 /usr/lib/firefox/firefox-bin -safe-mode -a firefox

That went well didn't it.

Never fear though, after much more searching, I've finally found the one simple command that will make all your firefox related memory problems just disappear:

% apt-get install opera

Editor's Picks

Free Newsletters, In your Inbox