Comparing Memory Usage of Firefox 2 vs 3
DaMan writes "ZDNet picks up on yesterday's Firefox 3 beta 1 review by comparing the memory usage of Firefox 2 against the latest beta. The results from one of the tests is quite interesting, after loading 12 pages and waiting 5 minutes, 2 used 103,180KB and 3 used 62,312KB. IE used 89,756KB.""
Seems to me that memory usage must still spiral under 3 beta, otherwise how would the single page/10 min usage be less than the 12pp/5 min test? Sure, it's not as bad, but that number really caught my eye... more testing is in order if I can get some time away from the in-laws over the holiday.
"Trolls they were, but filled with the evil will of their master: a fell race..." -- J.R.R. Tolkien on Olog-hai
From what I've heard this is common practice at MS. When the app gets minimized it releases/caches a lot of memory. There was a story on a MS person's blog but I'm to lazy to find it out.
Is it just me or does it seem like 60MB or even 34MB is a LOT of memory for something that browses Web pages?
I mean, people used to make fun of GNU Emacs, saying things like it stands for eight megabytes and constantly swapping or eventually malloc()'s all computer storage. Emacs takes somewhere around 10MB or so on a RHEL4 box, and that thing is practically an operating system. It reads mail! Firefox doesn't even read mail, and it takes 60MB. Opera reads mail, but still 34MB seems just too big, too.
Maybe I'm just getting to be a cranky old man. Now you kids get offa my lawn!
My blog
BTW I never found old FireFox's memory consumption as annoying as intransigence of some sites in refusing to support Firefox and the lax/laisse-faire coding for IE only. May be because at work I usually have a couple of four processor 16GB machine for development/testing. I used to have a dedicated 2GB machine exclusively for Firefox. But that old machine's hard disk started squealing with an annoying noise so I had to throw it away. Even at home with my puny 512MB 4 year old desktop or the 1GB 2 year old laptop I get by without any serious memory issues.
sed -e 's/Chuck Norris/Rajnikant/g' joke > fact
I don't believe this is only IE--when I listen to music on my computer on an airplane, I minimize the music program because it uses less memory, and therefore less battery (from my tests, Winamp Lite minimized uses the least RAM when minimized of all the players I tested. It was better than Foobar and mplayer, etc).
In fact, I just tried the same thing with Opera--it dropped from 60,000 to 11,000.
I don't think it's an estimate--I think the program really uses less RAM when minimized.
It's the "interwebs" what's really bloated. My Firefox executable here is taking just 7.3MB, but then you open several web pages that take MBs each, and some more in uncompressed, parsed form. Then some browsers cache other stuff like rendered pages in memory, and you get those figures we're talking about.
That behavior drives me crazy about Windows, so much so that I will often resort to forcing the page file down to 2MB just to keep it from swapping my applications out when I Minimize them. I hate having a system with 2GB of memory and having to wait 30 seconds for it to page some application back in (slow laptop HDDs don't help) just because it thought I might want a lot of free memory for some reason.
I read the internet for the articles.
Actually, that 'low memory bug' has already been fixed - I've downloaded the beta and installed it on WinXP - after looking at 2 pages, Firefox 2 memory usage was at about 45MB; Firefox 3's memory usage was up to about 750MB after less than 5 minutes (and the same 2 pages; in two tabs, just as with Firefox 2.0.0.9), completely bringing the machine to a crawl (1GB mem; and apart from Firefox, Outlook, Eclipse and SquirrelSQL were open)...
I'm reverting back to Firefox 2 for the time being, and will file a bug report once I have some more time to find out what's causing the issue...
If I don't shut down Firefox when I leave work for the day my system will be at a dead crawl in the morning - it shouldn't do this. (The only other program that acts like this is MS Streets & Trips). I am annoyed that Firefox is painfully slower to load certain pages - I do a lot of work for an in-house Quickbase application and MSIE blows firefox out of the water performance-wise, to the point where the same page in MSIE will load 3-5 times faster than it will in Firefox.
If the g'vt kept the data on you that google does you'd better believe you'd be calling it "doing evil"
What about a task manager extension for firefox that shows how much memory each extension is using? Seems like it could be useful. I mean, we know how much memory firefox in general is taking up, but it would be nice to get a breakdown of where that memory is going to.
Anthropic principle: We see the universe the way it is because if it were different we would not be here to see it.
But I'm testing Opera 9.5 Beta and I have 42 tabs open.
Checking RAM usage, it's using 237MB right now, as reported by Process Explorer.
We are Turing O-Machines. The Oracle is out there.
Don't do that. "But I want to keep my applications in memory!" you might say. That's wrong. Virtual memory systems these days basically use main memory as a cache for the disk. It doesn't matter whether a page came from a file, an anonymous application allocation, or anywhere else. The kernel automatically keeps the most frequently used blocks in RAM and pages everything else out to disk. By using 0 for swappiness, you defeat that automatic management and force the kernel to treat application pages specially. You don't want to do that.
Really? Because I can do it in one page. I tried out FF3 yesterday. Opened our local search page (about a 4K page with very little other than text) and let it sit for 2-3 minutes while I worked on something else. Suddenly the machine slowed to a crawl, the drive went to 100% on, and by the time I could finally get Task Manager open a minute or two later, Firefox.exe was at 635MB and climbing.
I can reproduce it every single time.
Life, the Universe, and Everything... in my image.
Can't be done.
You probably were foolishly deceived into thinking of extensions like an extension, something that hooked into well define extension points. (I wonder where you got that idea?)
They aren't.
Think of an extension as a run-time patch, which is much closer to the truth. There's no separate name space for extensions. This means that extensions can step on each other, since they're all operating in the same giant JavaScript mess.
When it comes to the UI, the browser uses a system called "overlays" which are basically a method for specifying an XML patch. It literally patches the browser's internal XML representation of the UI with new elements.
Two things there: first, the UI is represented by an XML tree at run time. (And you wondered why Firefox took a lot of memory?) Secondly, it actively alters the internal structure. There's no way to separate memory usage into what the extension added and what Firefox started with, because it's merged into a single final "patched" version of Firefox.
Firefox extensions don't so much extend the browser as they actually alter them. One side effect is that extensions can't be toggled on or off without restarting the browser.
Ultimately there's no way to track how much memory they're using compared to how much Firefox is using, because the final result in a "patched" Firefox with the original Firefox XML and JavaScript merged with all the extension XML and JavaScript.
Well - Microsoft may be distributing Sysinternals products; but Marc Russinovich's Blog postings are becoming less and less frequent.
AND - Sysinternals used to distribute the source on some of their tools. No longer. It's out there. But it's not legal.
These are my friends, See how they glisten. See this one shine, how he smiles in the light.
You know what, your post made me think of something: Why can't I see the processes of plug-ins separately from the browser (and kill them too)?
I'm the lead for a group of over 20 engineers and programmers that produces public safety communications equipment and have direct experience with memory leaks large scale C++ projects AND Firefox. The system we sell includes embedded devices, a Linux/Oracle/Apache server for management, and management terminals. Management and monitoring is done via web browser, either on Windows or Linux. We officially support both Firefox and IE, and both leak memory. We strictly control what is installed on the management PCs - no browsers extensions, no ActiveX components, no Firefox Ad-ons. Typical usage is to open the browser and monitor one page continuously for weeks until an alarm is shown.
Let me be clear, both Firefox and IE leak memory so badly that even on management PC with 2GB of RAM we have to require the end user to restart the browser every week. We are monitoring FF3 and looking forward to reduced memory leakage. In the referenced article it discusses reducing memory fragmentation. OK, that's a worthy goal but first fix the memory leaks. Memory fragmentation and memory leaks are related, but different beasties. A memory leak almost always results in fragmentation, but fragmentation can happen simply from an unfortunate memory allocation/deallocation pattern.
Regarding C++ and memory leaks: over 2 1/2 years we've worked on the embedded code, which is pure C++, we have hunted exactly one memory leak. And that leak turned out to be from the OS. We use Boost smart pointers, RAII, exceptions, and exception safe code. We have no trouble with leaks or fragmentation, despite a fairly high turnover rate and a customer base that would quickly notice memory leaks requiring reboot of the embedded devices.
Much as I love firefox I have to say that for me it still has memory problems. It isn't the firefox process itself but the resources it hogs in X.
Right now I'm running the firefox-3.0b2pre nightly builds and firefox is taking 236MB of virual memory. X is using 3560MB and xrestop shows the firefox pixmaps as being responsible for 2714M of that.
Memory use is a combination of necessary memory use, caches, memory fragmentation, and memory leaks. What you're describing sounds like memory leaks, not caching. The good news is that in Firefox 3, Mozilla developers' "extensive testing shows an occasional leak here and there and we are working to fix those, but in general we aren't seeing many leaks anymore." If you see any way to reproduce any memory problem in Firefox 3, please report it with the set of steps used to cause the problem.
What a fool believes, he sees, no wise man has the power to reason away.