I am using Firefox 22.0 on Windows 7 and noticed that it is ranked #1 on the “Memory (Private Working Set)” list, using about 350M of memory. What could a web browser possibly be doing with that much memory?
I’ve been wondering this for ages, so I’d like to add to your question if I may: Why does Firefox consume an increasing amount of memory when it’s not doing anything? For example, if I open it with several tabs, it might take 100 000 KB of memory. If I do nothing else in the browser, work in another application, then return, it might be at 500 000 KB.
It’s memory leaks and the latest release looks particularly egregious.
Switch to PaleMoon - it’s exactly like FireFox except way faster and less buggy, and it uses the same addons. FireFox just tries to remain too compatible with ancient hardware for it’s own good.
if you have plug-ins or extensions running that also might cause higher usage. it can do a lot of multimedia stuff.
Firefox 18, which is the last Firefox that works for me, is currently using 5.8GB. Certainly I have nearly 300 tabs at the moment, but it ought to be possible to minimize the amount used by long open tabs.
This is generally more trouble than it’s worth, since the operating system does this for you, for free. I suspect much of that 5.8 GB has already been paged to disk, if you really do have 300 tabs (:eek:), many of which have been dormant for a while.
There are two issues here. One is that the web can use quite a lot of memory. High resolution images and video take up a bunch of memory. The other is memory leaks.
Background: there are two common models for memory usage in programming languages. One is manually managed memory. That’s where, every time you want memory, you ask the OS for it, then, when you’re done with it, you explicitly tell the OS you’re done. The other is garbage collection. You still ask the OS for memory when you need it, but instead of explicitly saying you’re done with it, you just stop using it, and there’s an automated routine (called a garbage collector) that runs every once in a while and looks at memory. When it finds something that’s not being used any more, it tells the OS you’re done with that piece.
Both have their upsides and downsides. Manual memory management is better in the best case, but worse in the worst case. It’s more efficient and more predictable if you do everything right, but if you forget to tell the OS you’re done with some memory, then it never gets released, and you’ll just slowly accumulate memory that you don’t need anymore. This is called leaking memory. Garbage collection is easier to write and has a better worst case (you’re not going to leak memory), but it’s less efficient and less predictable. It’s less efficient because there’s no such thing as a perfect garbage collector, so you’re going to have some memory you keep that you are actually done with. It’s less predictable because you never know when the garbage collector is going to run. And if it decides to run and take a while you’re, say, animating something, the system might stutter because the animation code doesn’t get to run. This makes writing anything that might display or render video in a garbage-collected language more challenging. You better make sure the garbage collector doesn’t run for very long in the 1/60th of a second you have before you have to display the next frame.
You either need to:
A. Add some indicator of sarcasm because that scenario is mentioned almost every time firefox’s memory usage is discussed.
or
B. Find a browser designed for your usage pattern. What you describe is an edge case in Firefox’s target demographic.
Meh, I just don’t care about the memory usage anymore: I’ve got 16GB of cheap RAM.
I’m more concerned with it stiffening up after a few hours, needing the dreaded ‘restart to clear everything’; and much much more with Mozilla’s demented copying of whatever the unspeakable Chrome or Opera does next. I would say it was at it’s peak around Fx 4, and since then has been declining into a minimalistic mess. And their useless refrain of ‘disable all extensions, then reenable one by one’, then ‘create a new profile’, as a cure-all has got massively tiresome over the years.
However, I shall never use a different browser. Even if it sucks, the others suck more. Fx Forever !
Actually - and I realize I’m losing serious geek cred here - I’ve recently abandoned Firefox as just being too slow, and am trying out IE again. I’m using the IE 11 Preview now, and I’ve got to say, it’s faster and uses half the memory of Firefox. It’s not quite as customisable as Firefox; I can’t change the tab behaviour, but I can live with that.
There’s an addon for adblocking, called Simple Adblock, and that’s about the only one I want or need. Note that there’s a free and a paid version - the freeware doesn’t block as many ads per day as the paid.
Chrome? Fine for those as like it, but there’s something about it I just don’t like.
Given RAM prices I don’t understand why more people don’t go this way. I usually have 150-200 tabs open (various projects plus personal tabs), plus an entire virtual machine (with it’s own browser open), several MS Office aps and it doesn’t break a sweat. Oh, and right now I have Bioshock Infinite running on Very High on my second monitor and my machine isn’t running any differently.
I don’t have a super-duper machine (though it was fairly powerful when I first built it), I just have buttloads of relatively inexpensive RAM.
Of course, it’s only so long before developers realize this and stop trying to plug memory leaks or being careful for it, so back to ground zero.
iamthewalrus(:3= provides a nice quick overview of the main issue. Languages with automatic storage management have come a long way, and in garbage collection a very long way. Parallel and incremental garbage collection algorithms have been around for a couple of decades, and there are even GC systems directed at soft real time applications.
The core of Firefox is coded in C++ and that alone (IMHO) is enough to doom it. But an enormous amount of Firefox is coded in Javascript - which is a language with automatic storage management (and a language that should have been strangled at birth.) I suspect the problem is much worse than simplistic memory leaks. It doesn’t matter if your system has perfect garbage collection, for as long as the running program maintains a single reference to the allocated memory, it won’t be reclaimed. Firefox is a very big messy beast, and with the proliferation of addons and constantly moving target of features, it just keeps adding more and more stuff, with not a lot of overarching control. Looking at Firefox on my Mac right now it is running 38 threads with only about a dozen active tabs, and chewing about a gigabyte of memory. No amount of simplistic garbage collection is going to harvest any un-needed threads, and whilst they are alive they will be holding down memory. Many of those threads are probably are result of various add-ons in use. Personally I won’t use a browser without No-script and Ad-Block makes things much nicer, if you use Facebook you want FB-purity, and so it goes. It is very likely that many memory leaks are the result of interactions between add-ons. The lack of any overarching control makes this very hard to manage.
After seeing this post I actually went and downloaded Pale Moon, and copied my Firefox profile, including all extensions, over. I’ve got them both running simultaneously now, with the same theme and extensions enabled, and according to Task Manager, Pale Moon is using quite a lot more memory than Firefox.
Right now I have this dope page open in Pale Moon and its using 214,468K. The Yahoo home page, which is surely more complex and graphics heavy, is open in Firefox (both browsers have Flashblock running) and it is using 106,996K: well under half the memory.
I am not seeing noticeable performance enhancements either.
I think you will find that for many developers this happened quite some time ago. About 1980. It just depends upon what you mean by careful.
Is it possible that a considerable amount of the memory is used for caching so that pages can be quickly loaded?
I don’t know of any browser that uses less. Internet Explorer may look like it does, but that’s because it’s offloading to other parts of Windows. You can do that when you are that integrated into the system.
Now 1GB for 22 tabs–yes, that’s excessive. But 350MB? Meh. There’s a lot of stuff on those pages that has to be ready to grab at a moment’s notice, so it’s all decompressed and rendered.
Oh, and, no, a substantial amount is not cache. That’s pretty small, less than 10MB or so, I think.
I think that everyone missed the point of the thread. What does Firefox even need 150mb of memory for? the application itself is only a few megabytes and it uses that kind of memory even if i open only a text based website with no images.
bingo. I have 6 tabs open.
So… anybody have any input on what I said?
The explanation is the memory leaks, as has been repeated in this thread several times.
There’s plenty of things developers can do that will suck memory fast if they’re lazy. Not fixing memory leaks or allocating too much memory are the two biggest.