Generally-speaking, all the browsers have caught up with Chrome now, but one thing Firefox now has is a really bad reputation as a memory hog.
Recently I switched to Opera for a few days because I wanted to find if there were any ocPortal bugs in there. There were a few, but also I really fell in love with it – Opera is such a wonderful browser nowadays, the developers deserve huge credit.
A couple of days ago though I decided it was time to give Firefox a turn again. Oh dear – at the "end" of today, it was using 1GB of RAM and I had zero tabs open. It reminds me why I switched, and why I have found it painful ever time I have to use it – it just eats memory. I've seen this on loads of varied computers and lots of other people report similar problems, but it seems only some people have the probems.
When Firefox eats memory it is much more than just using free RAM, it impacts also on the experience a lot. As Firefox allocates and deallocates memory the interface gets very jerky. Opening a tab might take up to a second sometimes. Closing a tab, around 0.5 seconds. Switching a tab, similar. Scrolling is not smooth, it jumps about a bit. Generally I find it is not a pleasant calm experience.
I could complain a bit. It does irritate me how Mozilla have enormous pots of cash yet seems like a clique of developers in Silicon Valley. I don't see why they don't just hire 100 engineers in China to solve memory problems, they could easily budget for it, and they'd probably get a return on that investment. But that's just my perception, and probably partly based around jealousy of not having the $56.8 million per year coming into ocPortal development .
So, I thought I would try and turn this into a positive and investigate …
First thing is to identify what is Firefox and what are the extensions…
Figures to nearest MB, of clean load, no pages (loading to blank).
Web developer: 4
Copy URLS Expert: 0
Live HTTP Headers: 0
Page Speed: 4
Selection Links: 1
I find that pretty interesting. 108MB isn't bad for a modern browser, and I'm impressed by the low usage of most of the addons. Firebug is high, but it's a big one so I really don't mind. LastPass was disappointing though.
I measured usage for a browser tab across a few sites, and it averaged out at about 27MB per tab. Again, that seems reasonable enough (pretty similar to what ocPortal takes to generate a page server-side really).
However, I found that closing tabs would only free 4/5 of the memory. Firefox doesn't free memory right away anyway, it tries to do at an opportune point, but if you go to "about:memory" you can force the matter.
So, I went through the extensions by trial and error and I found that Firebug seems to be causing this. If I have Firebug enabled (even when not visible), it causes something you can see in the diagnostics called 'zombie compartments'. And, it turns out there is a bug filed about it:
Pretty sad that this has been researched for 1 year almost, with no resolution. I have seen that some people are trying really hard at Mozilla to resolve this (there are some great intense technical blog posts about it), but the guys doing it just seem under-resourced. And, I just can't see why – Firefox is dying on it's arse yet Mozilla has a huge yearly income. There is no shortage of developers in the world (hey, Mozilla, give me 1% of your yearly income and I'll happily solve the bug that is killing your product). Oh, I thought I was trying to be positive – but I couldn't help myself slipping into my usual Mozilla-hating pattern. It's late, time to finish off I think .
So, now I have Firebug disabled and I will see if the next day(s) end with huge memory leakage or not.