Mozilla MemShrink Set To Fix Firefox Memory
darthcamaro writes "If you're like a lot of Firefox 4 users out there, you've probably noticed that Firefox has a serious memory problem — it uses more than it really should. At long last, Mozilla developers are finally set to take this issue seriously with a dedicated team called MemShrink that are focused on the problem. 'It's pretty clear by now that this is a much bigger problem than any one person can likely tackle,' Mozilla Developer Johnny Stenback said."
Any gains they make will be eaten up by the rapidly increasing version number.
Don't be a Chrome Clone, make the next release Firefox 4.1.
Bundle in MagnaRAM with Firefox.
A lot of it's got to be the increasing size of web pages in general. Now that most folks have higher bandwidth connections, web designers don't focus on keeping the download size small.
Multiply that increase by the size of your cache (how many times can you click "back" without hitting the disk?) and you can see the full scope of the problem.
There's no -1 for "I don't get it."
My experience has been that both leaks and overall memory use have gone down between 3.0 and 4.0.
At the moment, Firefox is at about 375 megabytes, with 16 tabs open. It has been open for 3 weeks. I do have browser.sessionhistory.max_total_viewers set to 3 and the anti-malware databases disabled though.
Nerd rage is the funniest rage.
A useful new feature in latest Nightly versions from Mozilla is about:memory. It gives you a full tree view of where the memory is being used. Of my 360MB which the browser is currently using, 101MB is JS, 46MB is storage (you back button and memory cache), 70MB on "heap-unclassified" whatever that is. JS seems to be the biggest consumer of memory.
OS X here -- I usually have 8 to 12 tabs open. I almost never see memory usage below 500M, and it usually grows to about 1G after 2 or 3 hours. Firefox 4 for the Mac is seriously broken w.r.t. memory usage IMHO, and if they can't fix it fast, I'll probably be switching. I clobbers the performance of the whole system when it hogs that much memory. I'm tired of having to restart FF all the time.
That's all? 450mb? I just checked and the latest version of FF4x is currently using 2.1gb on my system.
Anyway, I thought Firefox didn't have a memory leak? It's just how firefox is *supposed* to behave. That's what they've been saying since 3.0. You can go back to countless threads on Slashdot rehashing the same thing. "Firefox is using insane amounts of memory"... "Shut up, dumb ass, you don't know anything! It's SUPPOSED to use a gig or two!"
Out of curiosity, why so many tabs? Unless it's a page that will look different if you reload it, and you need to see what it was like the last time you looked, can't one just bookmark the page and open the bookmark instead of the tab? And if you already have a bookmark, just close it?
That way, the tabs won't hog memory and CPU.
Yay, it only took 5 years of bitching for them to actually look into it instead of blaming addons or your profile.
Your hair look like poop, Bob! - Wanker.
This is easily reproduced in FF4 when you load a page with lots of images. The mem tends to grow proportionally to the size of the images on the page. But this is the only scenariou where the mem usage is different from other browsers and needs looking into.
I think at least part of the problem is perception. Most people seem to have this mindset that using RAM is bad, and the more memory you have free and unused the faster your computer will be. These are the same people who think they're increasing their computer's performance by turning off superfetch, etc.The problem with this perception is that it's completely stupid.
Programs load data into memory because memory is fast and your disk and the network are significantly slower; hundreds or thousands of times slower, and pointlessly unloading the data from memory increases the risk of having to go back to the slower disk or network to retrieve it later. If you still have RAM available, it is actually detrimental to your system performance to free this data.
Now, when you're running out of RAM there is a problem, the operating system and applications should begin to free data that is the least likely to be useful in the near future to make room for whatever is needed at the moment. If Firefox has a problem it isn't RAM usage, it's that it isn't paying attention to global system memory levels and caching less aggressively when there is RAM pressure, and honestly I wouldn't know if that IS a problem because I have way more RAM than I've ever seen my computer manage to use.
It probably means memory allocated by the JS interpreter itself, whereas "storage" is more of a file and bitmap cache. Just guessing here (though I have hacked on Firefox code in the past).
-Billco, Fnarg.com
I hope this isn't just targeted towards firefox. Thunderbird is an unwieldy beast of an email app as well. No good reason that checking my email should involve consuming 200Mb of memory.
ôó
Wish I had mod points for you. But you also forgot to mention the people who say "Shut up dumb ass, you've clearly got a shitty system and/or are incompetent!" or the "Shut up dumb ass, you're obviously using the wrong/too many extensions!" as well as the "Shut up dumb ass, you've got too many tabs open" and the "Shut up dumb ass, you're not meant to keep it running for days!" crowd.
To those of you who can manage to open a hojillion tabs and keep them open for months at a time, congratulations, we're happy for you. But as a user whose firefox at work will routinely gobble 350MB just with my opening set of tabs, then go up to 700MB after a few hours usage, and then at some point in the next few days will start chomping like there's no tomorrow and eventually crawls the OS and then crashes when it hits 1.8GB (32bit limit), please take our word for it when we see Firefox having a problem. I can close up a whole bunch of tabs and only regain a few megabytes, I can close every tab and only regain a hundred or so megabytes... on machines with "only" 2GB of RAM you *need* FF to relinquish that memory. I've got nothing against apps using the memory that's there, but FF often behaves like it owns the OS, mallocing away whilst pushing other running apps out to swap.
It's nice to finally see what appears to be the beginnings of a concerted effort to address whatever combination of factors there are that contribute to the issue... but I do fear it's too little too late for a lot of people who've already jumped to chrome. (Personally, opera's been my primary browser since well before firefox was phoenix but it doesn't play well with the work proxy... it too can eat up vast chunks of memory if you throw enough gunk at it but I can always reclaim that memory by closing down a few tabs)
Not intended as a troll or a dig against FF itself, it's just frustrating sticking your hand up and saying "Hey! Got a memory problem here!" and be met with a barrage of assertions from people you've never met who insist that you must somehow be stupid, blind, mentally retarded or some combination of the above just because the same circumstances have never happened to them.
Moderation Total: -1 Troll, +3 Goat
A useful new feature in latest Nightly versions from Mozilla is about:memory. It gives you a full tree view of where the memory is being used.
Is this per-tab or global?
I need a 'top' like function for Mozilla that will tell me which tabs are using resources (usually a flash object that snuck by me).
Does FF5 let me use 'top' proper with per-page processes?
My God, it's Full of Source!
OUTSIDE_IP=$(dig +short my.ip @outsideip.net)
Oh, come on now, Netscape 4 would have taken at least half a megabyte to show those pages!
Wait, that wasn't a good argument.
My God, it's Full of Source!
OUTSIDE_IP=$(dig +short my.ip @outsideip.net)
Not just for nightlies any more - try it in the current 5.0b5 beta!
he problem is with programmers.
We all remember when every byte of ram used was worried about because RAM was a precious resource.
Now we have programmers who have drank the kool-aid of "Hey Ram is CHEAP and programer time is expensive.
Need another feature? Oh just compile is some humongous library that some other guy wrote that is so poorly written that not even the smartest linker can avoid linking in every dam line since every thing is interdependent on everything else.
This is objects gone insane. Need another property, another method, just pile it on, don't waste time refactoring the code so that you get what you need with the smallest footprint you can get.
Programmers need to re-boot their brains and start coding like memory is a precious commodity because it IS when everyone wants to have 100 tabs open in their browser, plus eclipse, plus gimp, plus this plus that plus the other and do all of this when re-compiling the entire Linux kernel.
Hey KID! Yeah you, get the fuck off my lawn!
Looks like the Url Classifier (worthless anti-phishing feature) is eating up a fair amount of resources for nothing. You look in your user profile, and you see the urlclassifier3.sqlite file keep getting bigger and bigger for no real reason, and you see that Firefox needs 24MB of RAM just to have it loaded and working.
Here's my list (sorted top 25, but may be misleading since some of the numbers look like sums of others)
win32/workingset 432,160,768
win32/privatebytes 420,995,072
malloc/committed 376,307,712
DescriptionValuemalloc/allocated 354,080,976
storage/sqlite/pagecache 79,423,848
js/gc-heap 66,060,288
storage/places.sqlite/Cache_Used 52,400,928
storage/urlclassifier3.sqlite/Cache_Used 24,250,888
js/string-data 7,282,684
layout/all 6,261,185
images/content/used/raw 4,043,747
images/content/used/uncompressed 3,444,586
gfx/surface/win32 3,398,208
storage/sqlite/other 1,589,512
malloc/dirty 1,097,728
js/mjit-code 913,507
storage/cookies.sqlite/Cache_Used 528,376
storage/formhistory.sqlite/Cache_Used 508,664
storage/extensions.sqlite/Cache_Used 494,144
storage/addons.sqlite/Cache_Used 362,512
content/canvas/2d_pixel_bytes 360,000
images/chrome/used/uncompressed 353,440
shmem/allocated 344,064
shmem/mapped 344,064
There are several things going on here:
1) JS JITs. These optimize for speed of compilation and speed of generated code; small size of generated code is not really something being optimized for except insofar as it helps one of the other two metrics. In the case of Firefox, just deciding to JIT a little less aggressively late in the 4.0 cycle saved a good bit of memory when JS-heavy pages are open.
2) Images. Sites are using more and more bigger images, in addition to larger and larger scripts. With images you have the options of decompressing on draw (slow, typically) or storing decompressed images in memory (uses lots of memory). Guess which one browsers are typically doing?
3) Leaks in webpages. By this I mean web pages that allocate more and more JS objects and have them all reachable (e.g. by sticking things in an array that's hanging off the Window) so the web page uses more and more memory. gmail did this until recently; they were working on fixing it last I checked. This means that if one of your "few tabs" is gmail and you've had it open for a while a lot of that memory could be actually being used by gmail.
about:memory in Firefox is being improved to make it easier to answer the "what's using the memory" question, at least....
With me it's never Firefox per se that does it, it's xulrunner and flash.
Computer's ground to a halt?
Hard drive paging like a mofo?
Why yes, xulrunner and flash are using 90% of all physical memory. Yet again. And I have flash-control plugins that only start the flash apps I say to start.
There is the problem of web sites too- one popular site generates mountains of of javascript garbage every times you
scroll. See for instance the bug 656347 in the mozilla database.
The site? Slashdot. Mozilla is not happy the way Firefox manages this, but relying on garbage collection
very time you push arrow down is bad.
I haven't paid much attention to memory usage on Firefox in a long time, until I saw this article, because while it still uses a lot, it stopped causing it to crash like it used to. Sure, it still crashes, but a couple times a month rather than every hour or two, like it did prior to 3.6. However, the last time I watched memory usage on Firefox (both on OSX and Windows; didn't have FF running on linux), I could just sit there and watch the memory utilization increase by about a quarter of a megabyte per second. I could watch it for hours and it would just keep climbing, indefinitely.
I probably use more tabs than the average person, but I don't think that necessarily explains why an idle browser should continue to increase in memory usage for hours after the last page or tab was opened. I also don't understand why there isn't a more sane way of handling tabs. Why does every tab need to remain in memory? If I have a group of tabs that I haven't switched to or touched in three hours (or days, for that matter), it seems maybe those could be written to disk and the tab would consist of just a simple screenshot for display in Panorama/Tab Candy mode?
I've seen the behavior on multiple systems, even without any extensions installed. Like I say, I can understand high memory usage if you have an obscene number of tabs open (though I think there should be better ways of handling those tabs than keeping them all in memory), but I don't think it explains why an otherwise idle browser should increase in memory usage hours after it was last touched.