Taming Firefox memory usage

15 June 2010

Firefox seems to eat memory like rats in a wheelie bin.

Successful programs often become so complicated that they are like operating systems in themselves, so complicated that they struggle with system type issues such as having perfect garbage collection, Firefox is one of these!

The irony is that Firefox's predecessor Mozilla, become too complicated, bloated and resource hugging. So Firefox was re-factored out of the code base as a small and fast browser. Now it is repeating the same cycle. This is not an entirely fair comparison, as Firefox has to deal with a Web filled with high resolution images, video and so on that Mozilla never did in its day.

Anyway, when Firefox goes into a crawl I have just ignored it, just restarting Firefox every so often when it hogs RAM. I also occasionally clear out the cache, history and all the other crap in the hope that it will help too.

I noticed today that I had only five tabs left open yet 86% of the laptop's memory is being used by Firefox, when I looked a bit further into it, a good chunk of that was on a process called npviewer.bin - i.e. Flash. 46% of my laptop's memory (2 GB) was being spent on Flash!

http://commandline.org.uk/images/posts/firefox/firefox_memory1.jpg

Finally something had to be done.

I decided to install an extension called Flashblock. This prevents the downloading of flash content until I agree to it, any Flash content is replaced by a play button.

Extensions can cause memory leaks, so I decided to remove all the extensions I don't use any more, and to disable ones that I use very rarely. We will see if my Firefox is now more nimble.

http://commandline.org.uk/images/posts/firefox/firefox_memory2.jpg

Memory Settings

One can set configuration settings to limit the amount of memory that Firefox uses to cache pages and store session history. As it happens, I decided not to do this yet, in order to see what effect the above steps I have taken make.

You can look at what is currently in Firefox's memory cache by putting this into the location bar:

about:cache?device=memory

So on the available settings. For each you need to type about:config into the address sbar, in order to add the settings.

browser.cache.memory.capacity

This limits the amount of memory that Firefox will use to store images. Set to the cache size you want in KB. So to set the maximum to 24MB give the number 24576.

browser.sessionhistory.max_total_viewers

This limits the amount of memory that Firefox will use to store old pages. This speeds up going backward and forward through pages.

config.trim_on_minimize

This one only works on Windows. If set to true, when Firefox is minimised, the cache is swapped from RAM to disk.

Browsers and speed

There is an adage I have often heard in mailing lists which goes something like this: 'Software can be fast, cross-platform or beautiful. Choose any two'.

The hope was always that the GNOME project would come out with its own light browser that would be beautiful and efficient, beating the lumbering yet cross-platform Firefox. After many promising developments in Epiphany and Midori, this has yet to happen.

So what browser do you use? Has your Firefox had slow moments too? Any good tips to share with us?

1 Chris Adams says...

This is why Chrome is my default browser: I've never even felt the need to look for internal settings to tweak. It's also better looking and cross-platform so I'm not sure that quote is applicable. The lesson I'd take is a potent reminder that architecture matters: despite a long head start and, at least fir awhile, a larger developer community everything Mozilla-based has fallen behind the webkit browsers, I suspect in no small part because there's so much code to push around.

(This is not to disparage the Mozilla devs, to whom the web owes a huge debt - and who are clearly working to stay in the game. I think it's more a huge reminder of how much avoiding complexity can be worth.)

Posted at 9:13 p.m. on June 14, 2010


2 Dion Moult says...

I'd try looking at Opera. The 10.60 version by some benchmarks beats chrome and it's feels very lightweight despite an amazing number of features built-in. It's also the first browser I've ever left smooth scrolling on because it works so well.

Posted at 7:35 a.m. on June 15, 2010


3 Skilldrick says...

I'd second Chrome as default browser. FF is still useful for web development, but for browsing Chrome rocks my world.

Posted at 6:38 a.m. on June 21, 2010


4 andrea says...

I use this :)

https://addons.mozilla.org/en-US/firefox/addon/67651/

it works :)

Posted at 1:57 p.m. on July 14, 2010


5 Ashley says...

So that's what npviewer is? I always saw it in top but, I guess, was too lazy to Google it. I'll be taking these steps, thanks!

Posted at 3:34 a.m. on August 5, 2010


What do you have to say?

Show Editing Help

About

Hello, my name is Zeth, I'll be your host here.

Command Line Warriors is about taking control of your own technology, it looks at our experiences of computing; especially using GNU/Linux, the Python programming language, the command-line and issues such as techno-ethics, best practices and whatever is cool now. If you take control of your technology then you are a Warrior too!

This site is your site too which means that you can contribute and get involved. You can leave comments using the facility provided. For me, the comments and discussions are by far the best part of the site. So please do have your say!

Latest Discussions

Essex Web Design

September 3, 2010
A lot of contract providers give you free internet usage now, but if you have Pay As You Go, then you are going to be paying heavy prices.
Calling time on mobile internet nonsense?

Krasochka

September 2, 2010
Hack again?!
Adding more terminals to your function keys

GenryFlorist

September 2, 2010
<b>Cheap flowers delivery around the world!</b> Celebrate summer with our gorgeous flowers. They?re the perfect gift for any summer occasion. From birthdays to anniversaries, we offer beautiful flowers, lush plants, ...
Burning an iso to CD on Windows

auto-financing.co.cc

September 2, 2010
auto-financing
ReStructuredText tables and doctests

rubaxa

September 1, 2010
FTP = NOT RANDOM software Dominated hands postflop suckout often on all-ins. EX. AK vs. A9 or KQ vs. K6. Both players hit top pair. Bad player goes all in ...
Burning an iso to CD on Windows

empodayaddelm

September 1, 2010
Sorry admin - my post is test
This Week: Heroes and Monsters

increase synthroid dosage

September 1, 2010
Latest world news: 1 <a target="_blank" class="ext" href=http://www.maktabti.org/profiles/blogs/viagra-cialis-buy-no>buy cheap cialis generic levitra viagra</a> Viagra 2 <a target="_blank" class="ext" href=http://www.maktabti.org/profiles/blogs/buy-viagra-online-at-lowest>rainbowpush discussion board buy viagra</a> Viagra 3 <a target="_blank" class="ext" href=http://www.maktabti.org/profiles/blogs/how-to-get-generic-brand>search viagra ...
SFTP in Python: Paramiko

Lacilslaw

September 1, 2010
HYUN JAIMIE enniless and homele JAMILA
This Week: Heroes and Monsters

domaserisk

August 31, 2010
who was shaking his head back and forth knowingly Grissom shifted his eyes over at Brass,
How I Removed Windows from my Laptop

get ready loan

August 30, 2010
Though, by the you kill the legitimate PC user from visiting the site. Also, think about the dynamic IP's issue.
Only the penitent man will pass - on captchas and cotton wool

Packers and movers in pune

August 30, 2010
The topic you disscussed here is very amazing, informative and useful in future...
On Comment Spam

serhanters1

August 30, 2010
?? ???????? ??... ??????...... ??. ????????? ??? ??? ???????D ???????? ??. ????? ????? ???? ??? ???=) ?? ?????- http://letitbit.net/download/8746.894a84bc20f38f1661895aeee0/stereokartinki.html ???http://f-zona.ru ? ? ?? ????????????
Burning an iso to CD on Windows

strona startowa

August 29, 2010
Thanks For This Post, was added to my bookmarks.
Python CGI contact forms

lerexottori

August 29, 2010
?????????????? ??????????
Adding more terminals to your function keys

KelpAugmeme

August 29, 2010
aofaapsymp, http://forums.quark.com/members/jennaq.aspx online stock trading broker, rdgofzary
PuTTY Series: Adding PuTTY to your system path

Cheeday

August 28, 2010
What flowers do you like?
This Week: Heroes and Monsters

magfcvb

August 28, 2010
??????? ?????????????? ?????? - ????? ?????? ?????????????? ??????, ?????????????? ?????? ???????, ?????????????? ?????? crosman, ???? ??????????????? ??????, ?????????????? ?????? ?????? ????????. ???? magazin-oruzhie.ru
Include ODF support in the Linux Standard Base?

noni

August 28, 2010
I find myself coming to your blog more and more often to the point where my visits are almost daily now!
On Comment Spam

Latenadsfes

August 28, 2010
http://mynewblog.for-breastcancer.com/ http://mynewblog.photoblogcentral.com/ http://ilovezebras.thechicks.org/ http://mynewblog.cyberbardsymposium.com/ http://wewphost.com/ilovezebras/
Burning an iso to CD on Windows

LeupoldEst

August 28, 2010
pretty cool stuff here thank you!!!!!!!
OOXML Vote Coverage