The Inside Track on Firefox Development.

« Camino 1.0 | Main | More on Memory »

February 14, 2006

About the Firefox "memory leak"

A lot of people complain about the Firefox "memory leak(s)". All versions of Firefox no doubt leak memory - it is a common problem with software this complicated. We look to fix the issues where we can. David Baron and others have done a huge amount of excellent work in this area.

What I think many people are talking about however with Firefox 1.5 is not really a memory leak at all. It is in fact a feature.

To improve performance when navigating (studies show that 39% of all page navigations are renavigations to pages visited < 10 pages ago, usually using the back button), Firefox 1.5 implements a Back-Forward cache that retains the rendered document for the last few session history entries. This can be a lot of data. It's a trade-off. What you get out of it is faster performance as you navigate the web.

For those who remain concerned, here's how the feature works. Firefox has a preference browser.sessionhistory.max_total_viewers which by default is set to -1. When set to this value, Firefox calculates the amount of memory in the system, according to this breakdown:

RAMNumber of Cached Pages
32MB0
64MB1
128MB2
256MB3
512MB5
1GB8
2GB8
4GB8

(reference: nsSHistory.cpp)

No more than 8 pages are ever cached in this fashion, by default. If you set this preference to another value, e.g. 25, 25 pages will be cached. You can set it to 0 to disable the feature, but your page load performance will suffer.

Edit: In the comments, Boris and David pointed out that I misread the code, and that this is a global preference so that there are no more than 8 cached pages for the entire session, not per tab. My initial posting had claimed that it was per-tab. Oops!

Posted by ben at February 14, 2006 9:34 AM

Comments

How do other browsers (Opera for instance) use fastback-like technology without ramping up their browser's memory consumption? Is it a design flaw?

Posted by: Simplex at February 14, 2006 10:38 AM

Well I'm quite tired of people complaining about this subject. Thanks for the explanation.

Posted by: Ken Saunders at February 14, 2006 10:59 AM

I think the all-tab memory cache is the cause of a lot of "memory leak" moaning and groaning too, you should probably talk about that also (e.g. if you start a new Firefox, open a bunch of tabs, then close them all, the memory usage doesn't go down much because you've just populated the memory cache).

Posted by: Justin Kerk at February 14, 2006 11:08 AM

Maybe 8 is not the best upper limit?

Do users *really* need to go back 8 times? People usually does back a couple of times but 8....

Posted by: Diego at February 14, 2006 11:16 AM

Hmm, because I have tabs I don't use the back-button very often any more. If I expect to return to my current page, I open the new page in a tab instead. Actually tabs has totally changed the way I surf the net, and I'm very happy about that change.
I've got 2GB memory, so guess I should definitely change this setting. It's not completely unuseal that I got 10+ tabs open at once!

Posted by: Stig at February 14, 2006 11:21 AM

While there are still some problems with Firefox itself and memory leaks, from my experience most memory leaks comes from certain extensions. I believe Jesse Ruderman has talked about this also and pointed out some popular extensions that have caused problems. I believe it is becoming absolutely necessary to set up some detailed review process before extensions are added to the Mozilla site. Fair or not any problems caused by an extension most people will blame on the Firefox product itself. I believe now the process is just focused on making sure extensions work, and install/uninstall correctly. Will we ever see any sort of more detailed review process before extensions can be added to the add-on site?

Posted by: Leslie Franke at February 14, 2006 11:23 AM

...And I have never gone 8 times back, not in the old days without tabs either. And even if I seldom wanted to go 8 steps back, it would be such a speciel situation that I wouldn't care much about the speed.
But I might ofcourse not be an average user:-)

Posted by: Stig at February 14, 2006 11:24 AM

Perhaps it would be helpful to post an addendum describing the average memory usage of one cached page at a few common sites.

Posted by: RA at February 14, 2006 11:27 AM

Users with a lot of tabs, really need 5/8 "back-forward cache" per tabs ?

Seems to be better to reduce cache max when tabs number increase like this:

RAM: 1Go
1 tab => 8
10 tabs => 5
20 tabs => 3

Posted by: boris at February 14, 2006 11:29 AM

I think Simplex has a point. Opera uses tabs, just like Firefox, but they don't seem have any problems with memory.

What are they doing different? It would be interesting to know, because memory leak is a serious problem in Firefox, for those of us who don't have RAM to spare.

Regards,

Omar.-

Posted by: Omar Upegui R. at February 14, 2006 11:32 AM

I think it'd be way less confusing for people if there was a setting like "Amount of memory dedicated to Fastback" which would then be shared by fastback for all open tabs.

Posted by: lukem at February 14, 2006 11:44 AM

Ben my man, that worked. FF went from hogging 250MB of my ram to a swift 54MB with the same tabs and page clicks. Where were you 5 months ago ;)

Posted by: Jim Plush at February 14, 2006 11:53 AM

Guys, remember: unused RAM is wasted RAM.

Posted by: David Naylor at February 14, 2006 12:03 PM

Maybe the devs there at Opera know something, but even this explains a lot. thanks.

Posted by: PAStheLoD at February 14, 2006 12:04 PM

Concur with Boris. Smarter caching is in order here - simple solution that would do the world a great deal of help.

Make the #history per inactive tab something like:

Max caches total = 8 + (tabs*log2(tabs))/(some-fungible-performance-constant)

Distribute caches by following:

Current tab = 8
Other tabs = remaining/(current tab count - 1)

That would be a great starting point. Maybe I can help writing it myself with you. Never done OSS in the past... perhaps there is no time like the present.

Posted by: SourAaron at February 14, 2006 12:09 PM

Why does it need to remember these _per tab_? Isn't it a whole lot more efficient to keep an 8 page cache in general, over all tabs? At least then tabs can reuse each others cache (or can they already now, in which case keeping a cache per tab is even more strange)

Or in fact, when you keep it general instead of per tab, you can up this limit easily to 12 or 16.

Posted by: Paul at February 14, 2006 12:12 PM

whew, thank you for explaining this to all the idiots who've been calling this a memory leak issue. ive been trying to explain what you just wrote to everyone who's said this in the past (a LOT of people).

but i also agree with some of the comments here, 8 fastbacks isnt really necessary..

"Users with a lot of tabs, really need 5/8 "back-forward cache" per tabs ?

Seems to be better to reduce cache max when tabs number increase like this:

RAM: 1Go
1 tab => 8
10 tabs => 5
20 tabs => 3"

i thought this was a great solution. maybe next version firefox could use this system?..

also some people were mentioning opera as using the same feature without using memory. first of all, opera and firefox are both made by the same company.

second, its impossible for any browser that has the same feature to do so without using alot of memory. pages in memory are the same size no matter what browser. i suppose they could be compressed before they go into memory, but that would make things slow. expecially for older computers.

Posted by: daniel at February 14, 2006 12:16 PM

"Guys, remember: unused RAM is wasted RAM."

Yes but when Firefox eats up ALL of your ram and then the swap file as well then you have problem.

Users don't want to hear its because of a "poorly coded webpage" or "it's your flash plugin". They just want to use a brower that doesn't leak memory like there is no tommorrow. I think that is a resonabel request especially since that is what they are used to when they use other web browsers.

Posted by: user at February 14, 2006 12:16 PM

For me the issue is returning memory to the system. I once had Firefox using more then 800megs of memory with only one window containing one tab open. Over the past couple of days I had used dozens of windows with many dozens of tabs. Over this time I had had at least one Firefox window open at all times. It seems like all the caching from closed tabs was still using memory (if this was the cause of the stupid amount of memory usage). In order to return all the memory to the system I have to close all Firefox windows.

Posted by: Adam at February 14, 2006 12:17 PM

How would one go about changing this setting?

Posted by: maxpower at February 14, 2006 12:20 PM

So this explains why leaving Firefox running, with one tab open and no activity, all night long results in it eating up an extra 60MB of memory?

Interesting. This feature is sounding very Microsoftish.

Posted by: Strictnein at February 14, 2006 12:21 PM

Thanks for the explaination.

I have FireFox on a few systems with different amounts of memort and I can honestly say that the memory leak issue hasn't been a big deal at all.

Thanks for a greater browser!

Posted by: Matt at February 14, 2006 12:23 PM

>They just want to use a brower that doesn't leak
> memory like there is no tommorrow.

er, this is not a memory leak. the memory is freed if you close the tab.

Posted by: christian biesinger at February 14, 2006 12:27 PM

I'm so glad I found this today. I use Firefox 1.5 on a laptop with 2GB of RAM. Last night, i noticed that Firefox alone was eating up 600MB of RAM. I thought to myself, "why is a web browser eating up so much memory?". Now that I read this explanation, it all makes sense. I had several tabs (11, 12?) open, all with large images (artwork from allposters.com). I'd been browsing that site for a few hours, and given all of the graphical elements, it certainly makes sense. But oddly enough, the "snappiness" that you would expect to see from having everything cached in RAM wasn't really there. Firefox actually slowed down other apps running concurrently, due to the bloat. I went ahead and disabled this feature, and will try to navigate to image heavy sites to see if there is a difference in memory consumption.

Posted by: ThoughtCancer at February 14, 2006 12:28 PM

BS.

So when I close all tabs and close firefox, and it's STILL running, is that a feature?

It happens on both of my machines sometimes.

1.5 is a big disappointment. I have no problems with Opera.

Posted by: Matt at February 14, 2006 12:31 PM

Maybe you could get some inspiration from KHTML - it seems to manage this with only about 20KB per page, whereas Firefox goes up about 150KB for each page.

Posted by: ant at February 14, 2006 12:32 PM

So how do I access "browser.sessionhistory.max_total_viewers" to edit the value??

Posted by: Dino at February 14, 2006 12:33 PM

I must be special, 'cause I've never had Firefox use more than 100 MB RAM. Never. Right now, it has been running for several hours (and not just sleeping), and it's at around 62 MB. Not that bad if you ask me.

Posted by: Veracon at February 14, 2006 12:34 PM

Doesn't firefox fall back to the disk cache? And won't most recent pages be in the disk's in memory cache? I'd like to understand what the performance gain is before sacrificing memory, especially if the data is already cached at by another subsystem.

Posted by: paul at February 14, 2006 12:34 PM

"first of all, opera and firefox are both made by the same company."

You are very confused.

Posted by: Ben at February 14, 2006 12:35 PM

So, with the feature set to -1, lets say I 64MB of RAM free, from the chart I would get one page cached. If I opened up another program that brought my free RAM down to 24MB, would FF immediately cough up the cached page freeing up more RAM? If yes, that's pretty slick. No need to reduce the top end 8-page cache, in fact might as well crank it up to 9 or 10.

Posted by: mawrya at February 14, 2006 12:38 PM

How about having Firefox automaticallly release page caches when memory is running low so it will never uses the swap file?

Posted by: Eka at February 14, 2006 12:38 PM

How feasible would it be to flush the bfcache to disk on unfocused tabs?

This way switching tabs would load the current tab's bfcache into RAM and unload the previously focused tab's bfcache from RAM to disk.

This might not be feasible due to performance concerns on some machines, but a background load/flush seems at least theoretically possible. Thoughts?

Posted by: Brad Fults at February 14, 2006 12:39 PM

"also some people were mentioning opera as using the same feature without using memory. first of all, opera and firefox are both made by the same company."

ROFLMAO ... thanks, I needed that.

Posted by: Jorgie at February 14, 2006 12:40 PM

"I once had Firefox using more then 800megs of memory with only one window containing one tab open."

I'll see your 800 and raise you to, wait for it, 954MB!

Posted by: Maz at February 14, 2006 12:41 PM

Even with the newly improved 'Fastback' feature, it seems that Firefox is still slow to go back, unlike Opera which goes back without slightest delay. Anyone know why this is?

Posted by: Zeke at February 14, 2006 12:42 PM

when i first noticed the memory leak (call it what you will) the first thing i tried was closing all tabs; this never worked to release the memory. it has gotten to the point where i will no longer use firefox for work-related activity because a crashing browser is not really an option. i just changed the setting, hopefully it will resolve the issue/feature.

Posted by: matt at February 14, 2006 12:45 PM

So how do I access "browser.sessionhistory.max_total_viewers" to edit the value??

Open up a blank window, then go to the 'address' about:config. Then scroll down until you find it.

Posted by: phil at February 14, 2006 12:45 PM

When I use tabs, it's to avoid using the Back button and surf faster.

However, I know of at least 5 newbies users that are confused about tabs and avoid them. (I tried to explain but it still blows them away.)

Therefore this caching parameter should be dynamic so that it caches 8 pages when there is only one tab (or no tab) and 2-3 pages per tab when you have many tabs. More than that it's no gonna get used.

Posted by: Denis at February 14, 2006 12:45 PM

so why does the memory usage grow in this scenario:
1. got to one page
2. click a link to another one
3. click tha back button
4. click the forward button
5. repeat step 3

?

also i just observed that the usage grew when i closed a tab.

i now have only this page opened (in a new tab, no back or forward is possible, except using the go menu) and the memory usage did not go down a byte compared to what the value it reached during the browsing in other tabs before.

if i have no way to access that cached data (using back and forward buttons) why is it still kept?

Posted by: def at February 14, 2006 12:46 PM

To the person who said:

"whew, thank you for explaining this to all the idiots who've been calling this a memory leak issue."

Step down your elitist high horse. Firefox is a browser meant for all sorts of users, many of whom would require quite a bit of explanation about what it is causing this large amount of memory consumption. It doesn't make them idiots. When a user notices more than double the size RAM taken up when using firefox than opera when doing the same sort of surfing w/o any plugins, many would naturally assume it was a memory leak issue causing the problem.

Also, like someone earlier said, I don't use back very often, if at all, because it is so much easier to just open a page in a new tab when I think I am going to refer to the older page.

Thanks to Ben for the informative data on this issue.

Posted by: Jesus at February 14, 2006 12:48 PM

Makes sense, but it seems like if I have 30 tabs open browsing for a while, then close 25 of the tabs, I don't get much memory back.

Posted by: Christopher at February 14, 2006 12:52 PM

To change stuff in firefox type this in the url space and enter.

Remember your computer will blow up if you do this. Do it at your own risks.

about:config

You have been warn! Don't you go complaining after that :)

Posted by: Alexandre at February 14, 2006 12:52 PM

dino,

to change this value, type

about:config

in your address bar.

Posted by: j.goforth at February 14, 2006 12:55 PM

Wow, that really helped. It would be great if we could control this per tab - or, i guess for saving settings, per url. I don't see a need to have deep history on, say, a calendar, rss reader or email tab. But I'd want a high setting for a search tab.

Thanks for the info, and for helping cut down the memory usage from 850mb to 220mb.

Posted by: Mark at February 14, 2006 1:01 PM

dang, you beat me to it.

Anyway, I agree with 8 pages per tab being a little silly. I personaly rarely follow more than a link or two in a single window if I have any intention of going backwards. Keeping 8 pages is rather excessive for people who fall into similar use patterns. However since there are different use patterns, I would agree with the idea of limiting the number based on the tab count. I would however add that I could see this being added to the cache page of the preferences menu. Something where I could say "Use no more than X MB of RAM" and "Clear Flashback cache"

Posted by: j.goforth at February 14, 2006 1:02 PM

Good to know this, I had thought it was a leak myself. I use a lot of tabs but it turns out the biggest culprit is my always-on Bloglines tab. Closing it freed 160 megs of VM in one instance. A regressive algorithm for the number of cached pages based on the number of open tabs could be a good thing.

Posted by: Bjorn at February 14, 2006 1:09 PM

"unused RAM is wasted RAM" and "it's not a bug, it's a feature".

Conveniently ignoring what happens in the real world - Firefox simply consumes outrageous amounts of memory, it's done it since the beginning, and there has been no clear logic behind it. Fastback cache is a nifty excuse for the newer version(s), but doesn't explain at all why the previous versions hogged RAM until FF simply died or was killed.

Of course, calling it a "memory leak" might not be the most accurate way to describe it... but then again, if an application doesn't free up unused, unnecessarily reserved memory at any point, what should it be called? :D

This particular fix helps the situation somewhat, and I am grateful for it. However, I use all Big 3 on a daily basis, and so far the FF chews up more memory when viewing the same amount of pages (tabs in Opera, separate windows in IE). And since the memory is never released... that means several FF restarts every day.

It's been like this since the beginning, and hasn't improved. These experiences were gathered from the early betas to the latest official release, on Windows, on several machines. So it's definitely an issue in FF.

It's by far the best browser I've seen, but as an application on Windows, it's so-so.

Posted by: Rrright at February 14, 2006 1:09 PM

I wholly reject this explaination as to the source of problems with Firefox.

1 - 1.07 had GREAT performance, did it not use the same algorithm?

2 - When I see that FireFox is taking up 450,000k of memory, I close all of my tabs except for the last one. My memory usage (in Windows Task Manager) shows no reduction in memory usage. SO, my 1 tab, with Google on it is taking up 450,000k

3 - I (attempt) to have Firefox open for many days at a time. The memory issue never grew out of control with 1.07, but I cannot have Firefox 1.5.0.1 open for more than half a day before it eats up all of my memory.

4 - Firefox is geared for the more sophisticated web user (hence all the extra buttons and features) - the only time I use my back button is on web sites that are poorly designed.

5 - I get "phantom" Firefoxes in my Task Manager. No UI for these instances of Firefox. Flamers blame Windows, yadda yadda, whatever, the fact remains that something is up with Firefox, and it's not a tab cache issue. Period.

In an odd way, I am glad for this memory issue though. It has forced me to seek out other browsing alternatives (beyond IE and Firefox), and made me get off my duff to finally look at Opera (which kicks butt BTW).

Firefox needs to seek its "roots" once again, and quit talking about V2.0 and V3.0 until V1.5 is safe and secure to operate.

Posted by: Eric at February 14, 2006 1:10 PM

Why opera may be faster on reloads.

They might cheat, and ignore cache headers so instead of a refresh from the server, they merely pull from their disk cache.

I've found 1.5.0.1 to be better behaving than the previous ones. Wonky javascript sites don't slow my browser down as much as they used to. Apparently, the JS engine in Firefox/Mozilla doesn't handle some outmoded non-std javascript functions that sites written to IE use. These can cause Firefox to slow to a crawl, and even eat ram. Why? I don't know. I do encounter this left often. And sites that adhere to more std javascript code don't cause many problems anymore.

That said, my 1.5.0.1 hasn't hogged memory or run away on me yet.

Posted by: Daniel Joyce at February 14, 2006 1:13 PM

I got sick of these memory leaks that caused to system lock ups and slow preformace. This user has switched to Opera for now.

Posted by: Jason at February 14, 2006 1:15 PM

It becomes a memory leak when you open and close many tags. Firefox does not properly free this memory. So as you open and close new tabs, the memory usage continues climbing without ever going down. This constitutes a memory leak, as memory is used, but never freed.

Posted by: Adam Zey at February 14, 2006 1:17 PM

The limit of 8 pages per tab it's quite high, more taking into account that probably most of the people that uses tabs use the back button much less than previously.

I think that this feature needs some automatic training: if the user never clicks the back button then disable it, if the user clicks it then see how many pages he goes back, maybe one, maybe 2-4, more?, I wouldn't really expect fast back behaviour going back more than 2 pages.

So the system self-trains according to how the user behaves avoiding the waste of memory for those than aren't going to use this feature and using as less memory as possible for those that use the back button.

Anyway, a global Max for the total of pages in the back history could be a good idea.

But also the extensions need lots of attention, if a user is welcome to a.m.o. suggesting that those extensions are the most used ones, but it happens that some of those extensions give trouble (like it has been happening with Adblock) they won't understand a thing.
In a similar though, the Extend Firefox Contest winners should be choosen very carefuly, as many people will install them "because they are choosen as the best ones". I have to say it: I can't believe that IE Tab is choosen as a finalist, sorry that's offtopic, but it can bring all the problems of IE to Firefox.

Posted by: Alfonso at February 14, 2006 1:17 PM

This addresses some people's memory issues regarding tabs but there still exists another problem area: opening new windows. I've tracked memory and handles for firefox.exe while opening new tabs and new windows. When tabs are closed, the consumed memory is almost all returned. However, when closing new windows, the memory and handle count remain high.

I'll be trying a more scientific experiment in the near future but in the past 15 minutes I've observed that:
- Firefox consumes 25MB with one window (about:blank)
- Opening Google homepage adds 2-3MB
- Opening Google homepage in 25 tabs adds ~25MB
- Closing those tabs returns memory to ~35MB
- Repeating those steps nets roughly the same end result

Now, if I those same steps using new windows rather than tabs, the end result is 116MB of memory used!!! Repeating the steps brings that usage up even higher!

Please explain that.

Posted by: CDub at February 14, 2006 1:20 PM

"1 - 1.07 had GREAT performance, did it not use the same algorithm?"

No, the back-forward cache it's a new feature of 1.5, so the same algorithm isn't possible.

Posted by: Alfonso at February 14, 2006 1:20 PM

Interesting to note. Thanks for the correction.

Posted by: Eric at February 14, 2006 1:22 PM

"also some people were mentioning opera as using the same feature without using memory. first of all, opera and firefox are both made by the same company."

Your a dumbass.

Posted by: Selby at February 14, 2006 1:25 PM

"You're a dumbass." Not "Your a dumbass."

Dumbass! (just kidding about the last dumbass part lol)

Posted by: Eric at February 14, 2006 1:28 PM

if closing tabs doesn't reclaim the memory, then it's not bfcache causing the problem

Posted by: christian biesinger at February 14, 2006 1:30 PM

Question -

Do the extensions have a big effect on memory, depending on the extension? I would think that, since you don't have a lot of control of extensions, and someone can have 50 extensions to their browser, this would really hit the memory as well, right?

Anyone help me out here?

Posted by: JC at February 14, 2006 1:31 PM

Ben, those numbers are NOT per tab. The bfcache is global; there are never more than 8 pages total in bfcache (and you need to have 1GB of RAM for this to happen). Most users have 3 or 5 pages in bfcache at any given time.

Posted by: Boris Zbarsky at February 14, 2006 1:33 PM

The point of bug 292965 was that the pref should be global, not per-tab. Is that not working correctly?

Posted by: David Baron at February 14, 2006 1:34 PM

Forget that, on more than one machine I have access to Firefox when launched will not appear. Then when you pull up the task manager it shows as a process consuming increasing amounts of RAM eventually crashing the machine.

After asking around this appears to be a common bug.

This happens without plugins, but with plugins installed it seems to dramatically increase. This also creates an extra load time of the program intially by a good ten seconds if Firefox appears at all.

Posted by: Pope at February 14, 2006 1:35 PM

"For me the issue is returning memory to the system. I once had Firefox using more then 800megs of memory with only one window containing one tab open. Over the past couple of days I had used dozens of windows with many dozens of tabs. Over this time I had had at least one Firefox window open at all times. It seems like all the caching from closed tabs was still using memory (if this was the cause of the stupid amount of memory usage). In order to return all the memory to the system I have to close all Firefox windows."

This is my issue. I just don't get it. I can be at 500k usage, close the whole browser and wait for it to cleanup, then relaunch all my same tabs using sessionsaver and suddenly it's down to 50k.

I don't mind it using a lot of RAM to increase page performace. I just don't understand why it seems to be so stingy about releasing the memory.

Posted by: Daniel Talsky at February 14, 2006 1:40 PM

Thanks for the explanation.

Posted by: Heartless at February 14, 2006 1:55 PM

Memory cache and bfcache are nice, but if they are swapped to disk, the benefit is drastically reduced. At least with the memory cache I would imagine that it is better to just flush the cache if it can be detected that it is about to be swapped to disk.

In general, it may make sense to prune the memory cache and bfcache after a period of inactivity. If you haven't been using a tab or the whole browser for a while or a specific file in the memory cache, you probably wont mind waiting a little longer for the page/file to load.

Well, just some random thoughts :-)

Posted by: Christian Schmidt at February 14, 2006 2:01 PM

If you're having weird problems with Firefox like frequent crashing, bad memory leaks, or it stays running when closed I suggest trying a clean profile, here are instructions on how to do that.

This backs up your old profile so you can easily switch back to how things are now if the procedure doesn't help. This is for Windows but other OS users should be able to figure out the different directory locations.

Optional - Make a list of your extensions or download the latest versions all into one folder for easy installation.

Close Firefox, make sure it's closed by checking the task list if needed.
Rename the profile directory to Firefox-old. Note that "application data" is a hidden folder.
"C:\Documents and Settings\[user name]\Application Data\Mozilla\Firefox"

Uninstall Firefox from add/remove programs. Then delete the "C:\Program Files\Mozilla Firefox" folder to make sure it's completely gone.

Install the latest version of Firefox and run it.

Import your old bookmarks from the old backed up profile.
"C:\Documents and Settings\[user name]\Application Data\Mozilla\Firefox-old\Profiles\[random string].default\bookmarks.html"

Use Firefox for a while without installing any extensions to see how well it's running and hopefully the problems will be solved.

If a clean profile doesn't help at all and you want to go back to how things were you can close Firefox, rename the new Firefox profile folder to old1 and rename Firefox-old back to Firefox.

Posted by: Malakin at February 14, 2006 2:12 PM

Okay, a simple question. I have 512M ram on my laptop and as many laptops out there it's got a slow harddrive. I could say I'm swap -wary. I dynamically open and close tabs depending on how complex what I'm doing at the moment is. I'd like to use as many tabs as I need and then to have the (once used) memory *released* on closing the unused tabs.

So how come this doesn't seem to happen? Is it not supposed to happen? Is it an extension I have installed? Do I need to remember to restart firefox every now and then, just like I did restart Windows in the 95/98 days?

Posted by: george at February 14, 2006 2:17 PM

I would like an option to only have the current page in memory, and have the past X pages stored to a prebuffered cache file. If we specify the size and you calculate how many can be stored as per how many tabs are open and the sizes of the pages needing to be stored. If i'm going back, sure I like speed, but I don't need it in RAM to see the benefits. An option for storing this in a cache swap file would be excellent. (Not little cache files everywhere, allocate space before needing it)

Posted by: Uriah at February 14, 2006 2:20 PM

How about an advanced option that has a 5 position slider that has "maximum browser speed" on one end and "minimum browser memory usage" on the other, and let users decide what's important to them.

Posted by: Chris Sherman at February 14, 2006 2:27 PM

Thats was good to know.

Posted by: computadoras at February 14, 2006 2:36 PM

Ok dumbasses, why is that Firefox starts with 20MB private memory, after a lot of browsing it goes up to 120MB private mem then with one empty window/tab and cleared caches it goes back only to 50MB? What uses that 30MB plus when there's no open page and caches are cleared?

Posted by: Sebhelyesfarku at February 14, 2006 2:38 PM

Just a bit of info: the effect of the back-forward cache is extremely obvious if you have the disk cache disabled (like Portable Firefox). If you have the time, try it. You'll see this thing actually works. On the other hand, it's not so useful when you have the disk cache enabled (like most normal people). And I agree with the usage-pattern thing. I've always used new tabs if I'm going to return to a site. Occasionally, I may go back once or twice, but that's it. IMO, their should be separate options for back and forward caches. For me, back has always been more useful than forward (If I'm going to switch back and forth, I'm opening a new tab). Again: "USAGE PATTERN"

Posted by: nolookingca at February 14, 2006 2:51 PM

Ok not sure if this was asked before but how do i CHANGE the setting. Sure its set to -1 now and that = 8 tabs or 5 tabs depending on my memory, but can someone post a chart with values for say 2 tabs or 3 tabs. What do we set the value to then? 1? 2? -3? Help?

Just a simple settings chart with what each value change the max amount of cached tabs to. Thanks!

Posted by: ZoiD at February 14, 2006 2:57 PM

it'd be nice if this were the explanation, but it's not. disabling bfcache does nothing to help. in fact, i've seen the same problems back since firefox 0.1, and before firefox was even a gleam in blake's eye. it's a memory usage problem that's been in gecko pretty much forever. i don't think it's technically a leak though, because the memory *is* being reused by firefox. it's just never being released back to the OS.

https://bugzilla.mozilla.org/show_bug.cgi?id=130157

Posted by: scratch at February 14, 2006 3:06 PM

In my experience there are only some sites where I use the back button ( Google, forums ). It would perhaps be smart to use the smart loading to handle the back button caching. Only cache one old page per tab. When the user clicks back use the pre-loading feature to go and get the next previous page. Also note when the user uses the back button on a _site_ and increase the maximum number of cached pages for that site, upto the already determined maximum. Save the per site history cache level so that it can be used in the future.

Posted by: Jon Hart at February 14, 2006 3:13 PM

First off, I am a little above average web and firefox user. I have 128MB ram and most of the time firefox consumes about 40% and 60% of it. But I dont solely blame Firefox for it, some or most of the blame should go the extensions which are developed by average programmers who dont consider memory useage. I admit that when I browse, I open up 15 to 20 tabs at a time(each link in its own tab, usually) and I rarely ever use the back botton any more. Ben, the statistics that you provided cannot be applied to firefox since those stats only apply in the age with people only used IE and only one window.
As someone of you may know there is a temporary solution to you memory woes, and that is FreeRAMXP Pro (Free as in beer) or other ram freeing softwares. Keep it on autofree and it will periodically free up wasted ram created by Firefox (no offense).

BTW, thanks Ben for this info. It helps, I think.

Posted by: TheHinduMan at February 14, 2006 3:14 PM

I'd think it is wise to build a program memory handling this way: use as much memory as needed, then if it's closed there is no need to free memory at the same time. Only when the memory taken should be freed IF it is needed by some other instance. If Firefox would be restarted it would be great to have the page info handy as soon as possible. As the pages would still be in memory the tabs would load almost instantly.
Then, if the Firefox really has a problem that it just wont release its once taken memory Then it is a real problem. Has anyone tried to get Firefox use very much memory, then shutting it down, and maybe starting some other memory hungry app to see if Firefox would give memory back?
Just my cents..

Posted by: kuvittelija at February 14, 2006 3:31 PM

Opera's previous page load time beats FF 1.5 anyday. And their Ctrl-Tab page-tab cycling is better, but that's another issue.

Posted by: cj at February 14, 2006 3:32 PM

I wish there was a way to cause firefox to ignore cache headers and simply pull a disk cache up when the back button is used.

This is generally what I want when I click 'back'. I think that most users don't click back to get to a particular URL, they do it to retrieve the content that they had originally seen.

It's too bad that Firefox seems to pull a fresh copy off the web server every time the back button is used.

Posted by: Francis Esmonde-White at February 14, 2006 3:33 PM

I only experience FF hanging more often was when I upgraded to 1.5.

Is it lso possible that with this feature along with the Session Saver extension, we get more leaked RAM?

Posted by: abe olandres at February 14, 2006 3:55 PM

I'd like to add my support to the view that tabbed browsing changes that nature of the page revisits. The statistic quoted in the original post is probbly not accurate for multitab browsing. My suggestion is that the alogorithm take into account the number of tabs open. Or better yet, the amount of activity in each tab. Typically, I have one main browsing tab with 10-15 single page tabs were I read the article and close the tab. While 8 pages might be useful for the single main browsing tab, it's total overkill for the article tabs where I only ever navigate the single article.

While some heuristic would be complicated, I submit simply limiting the cached pages for all tabs to 8 + 1/tab. So each tab would retain at least 1 cached back/forward and the other 8 would be shared slots used on an LIFO basis.

Posted by: Steve Anderson at February 14, 2006 3:58 PM

Sometimes, I find that Firefox randomly sucks up 1GB ram and 1.5GB Pagefile for no reason, when I just leave it open on one page, even when i close that tab and open up a new one.

Using Opera now, and not having any problems.

Posted by: anonymous at February 14, 2006 3:59 PM

One trick we've used in the past with our desktop and server applications to reduce memory consumtion is to store a serialized version of the memory to disk.

Before you say "Hey it already does that" .. i'm not talking about cache files. Firefox "cache" stores a copy of html and graphics, when you navigate back it needs to re-render the page which is where the overhead is incurred -- what i'm referring to is storing the actual serialized data structures in memory directly to disk.

Serializing memory to disk so it can be reloaded quickly is not only handy and only negligbly slower -- it also significantly decreases memory fragmentation (which oddly enough in many applications actually gives you additional performance by inadvertantely better utilizing your on-chip l1/l2 cache).

Posted by: Brian Horakh at February 14, 2006 4:57 PM

I'm not quite sure that this is a problem with the bfcache. Even before bfcache was enabled (and even before 1.0.x), I've had the problem where I would have the browser running for a few days without ever closing it entirely, thanks to tabs. My browsing habits are such that I usually have 20 or more tabs open at one time, and I am usually opening new tabs at around the rate that I'm closing them, which is why the browser never exits.

What I had noticed is that after a few days, even when I close every single tab, the memory usage would be high, and that memory would be released only if I exit. If I exit and then reload all 20 of my tabs (thank goodness for opening bookmark folders into tabs), the memory that I use would still be significantly less than before I closed all those tabs and exited.

To me, this sounds like the canonical memory leak. Admittedly, I might not comparing apples to apples here; it may be the case that these old memory leaks from the days of Firebird have indeed been fixed and have now replaced by bfcache and sessionsaver's leakage (and with a comfy 1.5 GB of RAM, I don't care enough to test it out ;)), but I thought that I'd share what my own observations have.

Oh, and I think that overall, the problem hasn't been as bad with the newer versions. I have had about 100 tabs :) open in four different windows for the past couple of days, and the memory usage is about as high as when I'd have about half those tabs open in 1.0.x... (no, I have not controlled for variables like how memory/graphics intensive each page is, so this is more of a general feeling than anything precise)

Posted by: Kai at February 14, 2006 5:00 PM

"I wish there was a way to cause firefox to ignore cache headers and simply pull a disk cache up when the back button is used.. ..It's too bad that Firefox seems to pull a fresh copy off the web server every time the back button is used."

Is there a way to hack Firefox so the back button is fast like Opera?

Posted by: Zeke at February 14, 2006 5:05 PM

@zeke: use proxomitron to strip that header out before the page hits the browser. currently i'm doing that combined with a disabled memory cache and firefox memory usage is staying sane. we'll see how this holds up.

Posted by: scratch at February 14, 2006 5:08 PM

As I mentioned in two bug reports, the tool you want your end users to use for getting more info on memory leaks needs to be user friendly. you should seriously consider coming up with an extension that functions to monitor memory leaks.

Posted by: towsonu2003 at February 14, 2006 5:17 PM

That's great that firefox caches pages. And its great that they have done/know about the research that says 39% of page views are from the previously visited 10 pages (so all those saying they personally don't use that feature should defer to the research IMO - good design follows usage research, not individual anecdote).

What I don't understand is why it still sometimes takes so long to redraw a page when the back button is pressed. To me, back means, go straight back, but for some reason, Firefox seems to sometimes recheck the page, which introduces a network delay. If it really has to do that, I think it would be better to redraw the cached page first, then replace it with any changes once they come through if necessary. It would make it seem much faster.

Posted by: Xoc at February 14, 2006 5:18 PM

while you're fixing this so that less memory is being used by opening up a new tab and typing in the url bar "about:config" search for some other hacks that will speed up your browsing. Some stuff like network_pipelining and increasing it's value, I don't remember exactly, but search for 'em.

Posted by: hutch at February 14, 2006 5:47 PM

Sounds good to me - except for one thing. The table of MB RAM vs. cached pages is specious. We're caching HTML pages here, not full-length movies. There's no reason for the cache allowance to be so large for even a single page. So there is a memory leak - but one developers have documented and chosen to ignore.

Posted by: August at February 14, 2006 5:48 PM

@august: you're misunderstanding the table. it's saying that, for example, if you have 512MB of RAM in your computer, firefox will bfcache 5 pages. it's not saying those 5 pages will use 512MB of RAM, and if they do you've certainly got a problem.

Posted by: scratch at February 14, 2006 5:57 PM

Couldn't you save the rendered document to the hard drive? Surely loading that from the hard drive as one big file would be faster than the swapping caused by using such a huge amount of memory.

Posted by: Anthony at February 14, 2006 5:58 PM

Complaints about the Big Firefox Memory Bug predate bfcache, though. I don't think bfcache is the ultimate source of the problem...

Posted by: MechR at February 14, 2006 6:26 PM

The "memory leak" I complain about isn't a simple matter of Firefox getting excessively large (well, I do complain about that). My MAJOR complaint is that it frequently gets into a runaway memory grab loop where it goes from a "mere" 800 megs to 1.5 gigs in 30 seconds or less, before the oom killer gets to it.

Posted by: Timothy Miller at February 14, 2006 6:34 PM

Could it be that when browser.sessionhistory.max_total_viewers is set to -1,Firefox calculate the amount of free memory(not the total memory)and decide how much memory it should use for bfcache?It might explain why when a tab is closed,no memory seems to be released,Firefox just reserve the freed memory for other tabs.

Posted by: justkeeper at February 14, 2006 7:18 PM

Why not use a page size variable, instead of a page number? Instead of 8 pages, x number of megabytes total page(s) size.

Posted by: Andrew Shaw Care at February 14, 2006 7:21 PM

Guys, remember: unused RAM is wasted RAM.

Maybe there are other programs I'm running at the same time.

Posted by: ralphmerridew at February 14, 2006 7:53 PM

Why cache in memory?
Caching to disk (like other browsers) would perform just fine.

Posted by: Jason at February 14, 2006 7:58 PM

To all the people who keep mentioning Opera: Please cease. If you like Opera, please use it without comparing it to Firefox. Opera is the pretty sports car that works only on the highways. Firefox is the burro that can take you anywhere you want to go. The two products are different. You are comparing apples to oranges, despite what you may think. Opera, despite being years older than Firefox, still cannot render thousands of sites worth a damn. It even borks Yahoo! Mail badly, something even Konqueror doesn't do. Opera still cannot work with the vast majority of online bank websites, making it effectively useless to me. Get a grip, people. If you like Firefox, quit moaning about it. The same people who moan are the same people who are not volunteering to write code or documentation, or test bugs out for Bugzilla. If you complain, be prepared to act on those complaints in a positive way. If you want a better Firefox, help make it better.

Posted by: Rob at February 14, 2006 8:17 PM

This can certainly be regarded as a security flaw. A friend of mine kept a private blog of which she didn't want me to know about...

One time, she needed to make a post on her Blogger blog... so I lent her my laptop, and I also pointed her to use Firefox.

I guess that Blogger doesn't use https:, because I was able to go back to her Control Panel, even though she had clicked on 'log out'... and because the Blogger interface has those direct links ('View Posts')... I was able to figure out her address.

So, you see... there are vulnerabilities...

Posted by: rolandog at February 14, 2006 8:22 PM

Argh, this doesn't explain why the past releases have suffered from the same problems.

Oh well. My beloved Firefox might catch up to Opera again someday.

Posted by: Zain at February 14, 2006 8:23 PM

Slashdotted with a completely deceptive title. How typical...

Posted by: Anonymous at February 14, 2006 8:26 PM

I have 3 firefox(1.5.0.1) windows open
1 has 6 tabs
2 has 5 tabs
3 has 1 tab
task manager memory usage = 63.4M

Posted by: Kfazz at February 14, 2006 8:28 PM

the folks over at opera keep their fast back stuff on disk, this technique is slightly slower, but it does enable fast back technology without eating ram, where as firefox keeps its stuff right in the ram.

Posted by: george at February 14, 2006 8:43 PM

> ...And I have never gone 8 times back, not in the old days without
> tabs either.

I've been known to go back 20-30 steps, on occasion.

However, when I'm going back that far, I only expect the _source_
to be cached, not the rendered state. I would consider 3 pages
back to be far enough as far as cacheing the rendered state.
The source should be cached for as long as the tab is still open,
though, unless system resources are quite scarce.

On a side note, it is absolutely *vital* that to one or two levels
back more is cached than just the source, particularly if there
are forms that the user has edited. But yeah, going eight levels
back to a form and expecting the edits to be preserved would be
pretty "out there".

Posted by: Jonadab the Unsightly One at February 14, 2006 8:49 PM

Well, after all the high-end PCs that are available these days with more than 512MB RAM, its really poor to think that Fx is using more than xxMB of RAM.

I don't know if this option is available, but there could be a global variable that can be set by the user say Fx can at max use 100MB of RAM.

Posted by: Ruturaj K. Vartak at February 14, 2006 10:18 PM

I have a feeling that those people whose firefox grows to 1.5 gig overnight have either a faulty extension or they are on a site that's executing bad Javascript.

Maybe what can help Firefox is a very defensive Javascript engine that is immune to poorly written Javascript code. For example, allow Javascript engine to track the memory growth rates and to simply abort with an error when mem usage goes to a certain limit. This would have many benefits. First, the memory could be reclaimed (although not back to OS), and second, an informative popup could tell the user that the site they are visiting has bad Javascript on it, and this would place the blame on the site owner instead of the Firefox.

Without this kind of informative Javascript popup telling the user that some site is executing offensive code, the blame will of course go to the Firefox because the user isn't really going to debug the issue to see where the problem is.

It's as much a perception management issue as it is a bug issue. Let the user know where the memory leaks originate, and if the site owner is responsible and the leaky sites could be identified, then people will blame the sites instead of the FF.

Posted by: Leo at February 14, 2006 10:25 PM

Rather than basing a setting like this on "studies say", why not engineer a simple learning / self-optimizing algo that examines user behavior (# tabs, # back hits, amt ram, etc) over time and sets itself to something reasonable...

Keep an option to disable the auto-set, and allow ppl to manipulate the values as they can today...

?

Posted by: dxh13 at February 14, 2006 10:48 PM

What most users don't realise is the leaks can also come due to incorrectly managed/developed themes and extensions.

Personally, I have observed that FF as a vanilla browser has much less memory usage than FF with themes and extensions. Although, I could never figure one thing out. Even with your explanation of the FastBack feature, why doesn't FF free the consumed memory after windows have been closed?

And about the SessionSaver: doesn't it cache the tabs to a file on disk? Does the question of hogging memory come in?

Posted by: Shrikant Joshi at February 14, 2006 11:13 PM

Yes, I know, memory usage is sometimes related to extensions and themes and it might be related to Javascript. But it is no problem to raise memory usage to >300 MB with no extension installed, only one windows and one tab open, no Javascript and a clean profile.
Just go to a website that has thumbnails of pictures, open a hundred of the pictures or so in tabs until memory usage is at around 300 MB and the swapfile increased by 200 MB (at least that is waht happens on my 512 MB laptop). Then close all tabs except one. Memory usage might go down a little, but you end up with enormous memory consumtion. And even if you wait a few hours and have other applications runing that need memory (Photoshop for instance) Firefox does not release it.

I really love FF, I still use it, I don't mind if a feature needs much RAM, but if memory is no longer used it should be available for other applications. 300 MB + 200 MB swapfile for a single webpage is way too much...

Posted by: TfR at February 14, 2006 11:58 PM

I have also a problem with the memory usage. With a clean install, new profile no extensions i load about 20x 10MB images (for example from the galleries from dpreview.com) into tabs. (This is a dailt task for me, because i am a photographer looking on the works of other people) Memory usage goes up to 1gb mem because firefox stores an uncompressed version in its memory cache. (check with about:cache) closing those tabs does not release the memory to os, instead firefox keeps the memory allocated. so if i don't restart firefox keeps the memory and at some point the OS starts to page out. I believe this is was most people see. Surfing on graphic intense pages is at least the rease for me. Maybe someone can build a testversion of firefox with releasing the memory to the OS and those people with mem problems can verify if this helps.

Posted by: mrdom at February 15, 2006 12:07 AM

@Jason at February 14, 2006 07:58 PM
Quote: Get a grip, people. If you like Firefox, quit moaning about it. The same people who moan are the same people who are not volunteering to write code or documentation, or test bugs out for Bugzilla. If you complain, be prepared to act on those complaints in a positive way. If you want a better Firefox, help make it better.

For your information, most people cannot write code. If you bitch about them complaining about bugs in the program, it means that YOU have some very weird values. If people complain, they usually have valid reasons for doing so. If LOTS of people complain, there's bound to be something wrong with the program.
So far, by far, the most people complain about FF's memusage. Only very few are actually happy with it. This means there's something seriously wrong with it.
I've noticed it myself: I've set the amount of pages in bfcache to 0 (yes, zero, none, null, etc), and still the amount of memory in use goes up to 750 megs mem and 500-800 vm. For a browser, this amount is just simply insane, cache or no cache.
I really love firefox, it's a great browser, and I use it most of the time (only occasionally switching to IE for IE-only things).

Posted by: JF at February 15, 2006 12:08 AM

Hrm.....
Just noticed something in about:cache.

Memory cache device

Number of entries: 136
Maximum storage size: 15000 KiB
Storage in use: 25044 KiB
Inactive storage: 0 KiB

It's using more than allowed? What's the point of setting the max for this cache then?

Posted by: JF at February 15, 2006 12:10 AM

Maybe the developers should test this:
-disable plugins, javascript(all the 'memory hoggers')

Now open 400 tabs and let them load, Firefox will use about 300MB no problem here. Now close all the tabs but one. The memory useage will lower but only to about 90MB.

Now THAT is the problem most people are referring to when they talk about memory leaks.

Posted by: Ferdinand at February 15, 2006 12:25 AM

@JF Good questtion. I see this too. In my described situation max is set to 16MB and the storage in use is 800MB. Strange.

Posted by: mrdom at February 15, 2006 12:26 AM

I think the biggest problem isn't the caching of pages, but the way Firefox keeps the pictures on those pages in memory.

Take a look at this:
http://primates.ximian.com/~federico/news-2005-11.html#moz-images

Very interesting, I'd say..

Posted by: Tero at February 15, 2006 12:51 AM

Tools>Options>Privacy>Cache
Use upto xxx MB...

set it low, have no problems with cache taking up too much RAM.

Posted by: Greg at February 15, 2006 1:00 AM

"Please cease mentioning Opera"

Simple. Tell Mozilla devs to shut themselves up and do not get themselves in touch with the outside world and user suggestions.

Because people will compare features with products. Comeon, tell me who doesn't. Please don't make your post so one-sided.

It is competition that improves the quality of products. Imagine an IE-only world. There won't be an improvement.

Products that cannot keep up will fail and fade away. Take Netscape for example. IE4 won because Netscape cannot cope with the new features IE is having.

That is why Opera is adding a lot more features now. Firefox must keep up with IE7 and Opera's advancements and overtake it, only then they can rule the Internet.

Only exposure, acceptance and striving to improve will make Firefox better. Apparently this dev is hiding the fact that there IS a major leak. Opera uses less RAM and caches better.

MODS: Delete if you wish to hide these dirty facts. And bootlickers, feel free to flame me.

Posted by: lr96 at February 15, 2006 1:13 AM

Ben wrote: " You can set it to 0 to disable the feature, but your page load performance will suffer."

This is misleading, at least. Every new and non-cached page won't gain any advantage of this memory waste. You won't get any positive effect in page load either, if that site has changed, perhaps if you wrote a comment.

Deactivating this "feature" won't hit performance in most cases but save memory in every case.

Instead of cheating users by showing them old but already rendered content, I would prefer to get real faster basic rendering. Don't make the same errors like Microsoft, don't start cheating with enormous caches, and don't ignore bugs.

Ralf

Posted by: RaSa at February 15, 2006 1:20 AM

The second sentence should read:

"All versions of Firefox no doubt leak memory - it is a common problem with software this complicated _and written in a non-garbage-collected language_."

We have alternatives to C/C++ in areas where security and memory performance are important. It's just that developers seemingly think they are "smart enough" so their next project will be different from all others in that memory leaks and buffer overruns won't be a problem and can "easily" be avoided or fixed.

Posted by: Matt at February 15, 2006 1:49 AM

Yeah, thanks.

Having the "feature" really improves performance on my 512MB Mac Mini, especially when it leaks, sorry utilises 1.5GB of Virtual RAM. The entire system runs like a dog if I've had FF open for more than a few hours.

Posted by: Mike Thorpe at February 15, 2006 2:14 AM

Hmm, 1.5 GB?? Wow.
I use FF with multiple tab open always, and use it a lot. My living is part web-development, so I'd say I'm a fairly advanced and heavy user. And I have never seen FF use more than 150 MB here...And that is with 8 tabs open...for several days!

Posted by: Spinner at February 15, 2006 2:42 AM

I think Ben you should have mentioned that extensions too can cause memory leaks the latest version of Adblock Plus v6 for instance fixed a whole bunch of leaks and now memory usage hovers around 80-100MB with my 1GB box after several hours’ use whereby before it would be 300-500MB.


Also about the Opera posts it probably does do a good job with this sort of thing and some of the posters are genuine but some of them are no doubt Andrew K the Opera troll who has been trolling these blogs & other forums and websites bashing Firefox any way he can. He has toned down some of his rhetoric as it made him too easy to spot but I wouldn’t be surprised Ben if you check the IP and see that a few of them are the same.
See more about Andrew and his antics here;
http://www.webdevout.net/forums/viewforum.php?f=1
http://nanobox.chipx86.com/blog/2005/12/re-firefox-myths.php

Posted by: Tennse at February 15, 2006 2:43 AM

Hey, what about exiting Firefox and not returning the memory to the system?? Is that a system feature too??

Posted by: chris at February 15, 2006 2:48 AM

A couple of points worth noting here:

1: Phantom Firefoxes still running after closing the browser. This seems to happen to me after Firefox has invoked Java applets. That's the only clue I've got on that one.

2: Memory leaks. Some people have them, others don't, which leads me to suspect either installed extensions / plugins or video card drivers leaking resources.

Posted by: Phil Randal at February 15, 2006 3:16 AM

I am an average user and I use the 8-step back in all open tabs. And this feature does not use any great amount of memory. It must be a kind of extension you are using that allocates memory. Right now my ff session consumes 43MB with 4 tabs open and 10 step history in each tab. That's not a big when comparing to 42 MB of Adobre Reader or 32MB of Skype or svchost.exe.

PS. Congratulations for black text on brown background when error in sending post occurs :)

Posted by: maclav13 at February 15, 2006 4:10 AM

It may improve the browsers speed, but when my entire computer is crawling due to lack of memory, it does not really do much for me.

Posted by: Steavis at February 15, 2006 4:13 AM

If this is the way you view other people who sees flaws with your software, it's no wonder Firefox has had such a great development since 1.0.

Let me say it quick and painless: Firefox memory management sucks. And no, it has nothing to do with caching. If you view in the order of a hundred web pages per day (that's not as much as it may sound) using the open-in-new-tab-key, after a couple of days Firefox is using 500MB RSS. If it hasn't crashed yet.

Yes, RSS isn't everything, I know that. And probably a lot of data are buffers and caches and whatever. But here's one basic fact: It shouldn't crash. It should stop growing, re-using old memory for tabs. Compare with Opera, which used in a similar way for weeks still stays under 100MB and crashes relatively rare.

Posted by: Jonas at February 15, 2006 4:14 AM

In a bug report I posted several weeks ago, I described something that definitely is a memory leak:
Memory usage increased by 1 MB per second! Each open page was fully loaded and nothing changed, but the memory usage got higher and higher. The first time I noticed, it was at about one and a half Gigabyte before I killed Firefox.

FYI, nobody is working on this bug.

Posted by: Andreas Kempf at February 15, 2006 5:04 AM

Could someone make a simple extension, that would track the number of open tabs, cpu usage, memory usage and names and versions of installed extensions. All this data (with no privacy violating stuff like web sites visited) could then be sent to a server collecting statistics, for example every 5 minutes.

This info should reveal, what combination of usage and extensions lead to memory problems. What do you think, has this been though before?

Posted by: ilefix at February 15, 2006 5:47 AM

My feeling is that more than likely Firefox is not going to return any memory back to the system, unless FF team switches to a compacting memory allocator, which is unlikely for technical reasons.

The best that Firefox can do, IMO, is to stop growing at a certain size and to simply NOT render certain pages, if it must, but really stop growing and tell the user that rendering a certain page will take too much memory. If it's absolutely essential that Firefox does not grow, then Firefox code can use some hardcore tactics to make that happen. But I really doubt that Firefox will ever (never say never) release memory back to OS, unless it was allocated and deallocated in a very fortunate way.

Maybe improving the efficiency of internal storage (like using compression if necessary) together with defensive/sandboxed code that would rather refuse to render and/or refuse to execute Javascript than grow in memory, might be the best bet.

Firefox should also, if possible, find a way to isolate itself completely from extensions. If extension memory space grows larger than X, then extension should be automatically disabled by Firefox with a popup to the user asking if they want to submit a bug report to the extention author. IF they say YES, it redirects to the extension homepage or something like that.

All this can help improve Firefox perception, which is important for widespread adoption. The idea is to keep Firefox free from blame and to put more responsibility on bad web page design, faulty Javascript and extension authors.

Firefox, ideally, should be like an operating system: if the extension is misbehaving, it shouldn't affect the entire browser -- it should just be jettisoned unceremoniously. If the page is going to push FF over some preset memory image size, then don't finish rendering that page, period. This might not be easy to do -- it's like developing OOM killer for Firefox (and if I understand correctly a similar feature in Linux kernel was not easy to develop so that it worked in a satisfactory way).

Just some ideas (not to be taken too seriously, as I don't intend to start a flamewar).

Posted by: Leo at February 15, 2006 5:54 AM

Use OPERA you stupid people.
Opera works great, it doesn't have this bug with HUGE memory leak when you use BACK button.
Use Opera.

Posted by: reeven at February 15, 2006 5:54 AM

It's not just the leak... it seems to have an upper limit. I have 2 Gigs of RAM... and without fail when Firefox leaks... I mean "caches" ~400MB it crashes.

Posted by: Magoo at February 15, 2006 5:59 AM

Also a crazy idea, but what if in some cases Firefox is triggering a bug in some OS level driver, like, say in a video driver? I don't know enough about the code to say this for sure, but could it be that Firefox is triggering a leak in some driver and the system is reporting it as a memory space that belongs to Firefox?

If the above is true, then again this is a perception issue...

I also agree with the person on making an extension that collects memory usage stats and phones home every random(x) minutes.

It's one thing for the developers to be confident that they've fixed all or most of the memory leaks, but it's entirely another thing to successfully manage user perceptions. Even if you fix all the leaks, you still have to manage user perception! In an ideal world it wouldn't be like that, perhaps, but we live in a world where perception often is reality -- "If it quaks like it leaks memory and if it walks like it leaks memory, it therefore means it really does leak memory." So in my mind it makes sense to make an extension like that, even if devs insist that they are happy with the dev-only pearl/javascript memory leak tool that is currently out there.

Posted by: Leo at February 15, 2006 6:04 AM

@magoo:

Well if it crashes then you are in luck! :) Use the quality assurance talkback tool to send the crash report. That way at least the fact that your FF crashed will be registered.

In my experience FF has crashed only once, in a weird way too, where I had to manually kill firefox.exe in task manager (on windows xp sp2).

Posted by: Leo at February 15, 2006 6:14 AM

I just hit dpreview.com in a tab and loaded about 10 images or so, and my FF mem image is at 65M, while my about:cache page reports:
---
Number of entries: 327
Maximum storage size: 31744 KiB
Storage in use: 31652 KiB
Inactive storage: 1903 KiB
---
Number of entries: 5243
Maximum storage size: 50000 KiB
Storage in use: 46031 KiB
---

Nothing out of the ordinary.

Again, I'm not trying to invalidate what other people are saying. I just want to show that it's not the whole world who is experiencing these problems.

Posted by: Leo at February 15, 2006 6:22 AM

Well what do you know...

I opened dpreview galleries in 7 tabs, my total FF image size went up to 66M from 65M, but...

My about:cache page now shows:
---
Number of entries: 101
Maximum storage size: 31744 KiB
Storage in use: 35989 KiB
Inactive storage: 0 KiB
---

So, I duplicated the "storage in use" exceeding "max storage size" problem. :)

Posted by: Leo at February 15, 2006 6:29 AM

the problem is when u close a tab, the tab cache does not release?
also, these are all excuses, whatever you say, the fact is not so pretty, especially when browsing pages with large amount of pictures, opera DOES handle them MUCH BETTER than FX.

Posted by: crislevin at February 15, 2006 6:42 AM

for those who tested dpreview.com: Thanks for testing. But what images did you load? Maybe I have a problem with my videocard driver. I am using FF 1.5.0.1 on WinXP

Could someone please test it with this images?

http://img2.dpreview.com/gallery/canoneos350d_samples1/originals/img_3949.jpg
http://img2.dpreview.com/gallery/canoneos350d_samples1/originals/img_3957.jpg
http://img2.dpreview.com/gallery/canoneos350d_samples1/originals/img_3961.jpg
http://img2.dpreview.com/gallery/canoneos350d_samples1/originals/img_3967.jpg
http://img2.dpreview.com/gallery/canoneos350d_samples1/originals/img_3979-raw-acr.jpg
http://img2.dpreview.com/gallery/canoneos350d_samples1/originals/img_3982.jpg
http://img2.dpreview.com/gallery/canoneos350d_samples1/originals/img_3985.jpg
http://img2.dpreview.com/gallery/canoneos350d_samples1/originals/img_3992.jpg
http://img2.dpreview.com/gallery/canoneos350d_samples1/originals/img_3994-raw-acr.jpg
http://img2.dpreview.com/gallery/canoneos350d_samples1/originals/img_4000.jpg

Loading this images give the following stats:

Maximum storage size: 8000 KiB
Storage in use: 243740 KiB

TaskManger show M:254 VM:263

Posted by: mrdom at February 15, 2006 6:56 AM

I agree that it should release the cached pages when you close tabs. I have never ever seen the memory usage go down... it only ever goes up and up.

It's sitting at 215MB right now. Then i close all the tabs except one... and it's still using 215MB.

It may well be a feature, but the problem is as a user, I don't care whethe it's caching back 3 or 5 or 8 pages. What I care about as a user, is how much of my resources it's taking up.

The user should be able to say, you can use x MB's of RAM for your cache, I don't care how you do it. I've got lots of RAM, I don't really care if it uses a "lot", so long as I have some say over how much a "lot" is. For me, I think 200MB is about how much I am willing to give firefox and I should be able to set that as an option, rather than some nebulous number of pages, which has no correlation to what users cares about.

Posted by: Magoo at February 15, 2006 6:57 AM

Main reason I think it is a leak is this...

Number of entries: 1028
Maximum storage size: 44032 KiB
Storage in use: 45681 KiB
Inactive storage: 0 KiB

It's says it is using 45MB, I know that when i start up, it uses about 20-30MB... so my memory usage should show about 75MB, yet it shows 215MB. So about 140MB are not accounted for. If that is not a leak, I don't know what to call it.

Posted by: Magoo at February 15, 2006 7:01 AM

Sorry, can't help myself. :) I did a little more research on the talkback page. I searched for all the FF15 talkbacks with the word "leak" in them and this is what I got:

http://tinyurl.com/77qof

I'll restrain myself for making guesses, but maybe devs will find it interesting. There appear to be about 3-4 "leak" crash reports per day. That doesn't strike me as an awefully large number, but maybe many people don't feel like sending a talkback and/or don't think of checking mem usage and putting the word "leak" into their talkback description.

It might help to add one more bit of info to the talkback report: total memory image size of FF during the crash. Right now "user comments" field is the only chance to get valuable memory usage info from a crash report, and only if the user manually puts it in.

Posted by: Leo at February 15, 2006 7:04 AM

I did a semi-controlled test with this. Numbers were almost the same with it set at -1 and 0. The report and figures are posted here. I'm still not convinced that its not a memory leak.

Posted by: Ryan Duff at February 15, 2006 7:05 AM

@mrdom,

I loaded all your links into tabs, and indeed the cache balooned to this:
---
Number of entries: 100
Maximum storage size: 31744 KiB
Storage in use: 259865 KiB
Inactive storage: 0 KiB
---

Far exceeding the maximum size.

I am going to hazard a guess (I can't resist). It simply keeps all the stuff in the tabs in memory, regardless. Consider what Firefox would have to do to comply with 30 MB max mem cache limit? The images in your links are HUUUUGGEEEE. It's quite possible that a single image can overwhelm the cache limit. If Firefox is to comply, it will have to unload everything that is not in the focused tab. That means as you switch back to some of the other "fat image" tabs, it will have to reload the image again from the web site! This type of behavior might, arguably, be worse than exceeding max mem cache size in this case.

Ok, now I have closed all the "fat image" dpreview tabs and my cache usage is:
---
Number of entries: 90
Maximum storage size: 31744 KiB
Storage in use: 26585 KiB
Inactive storage: 0 KiB
---

So it did go down nicely, at least in this case here.

mrdom, what kind of behavior would you expect from the browser, if each individual image was nearly the cache max size in its own right? I mean, what would you want the browser to do? Unload the images from unfocused tabs and go back to loading them from the site when you switch back to the previous blurred (inactive) tab? That seems insane to me, but what do you think is right?

In any case, I do think that Firefox should degrade gracefully instead of crashing, but for some usage patterns, like with those fat dpreview images, it just makes no sense to have a slim firefox memory usage. How do you expect to view those huge images?

At the end of this exercise my FF mem image is still 65MB.

Posted by: Leo at February 15, 2006 7:19 AM

Memory and performance issue on long download history.

If I download a 700MB ISO image file I dont see any problem in performance.

But if I download 50 files of 0.5MB (ie total of 25MB) Firefox (nightly also) eat up almost 100 MB extra memory. And the performance goes down, ie after a click it take much time for download dialog to show up, and download speed also reduced to half (on a 2mbps DSL).

Restart Firefox, it again consume 4 times memory for every downloaded file. And download performance is still bad. (note: normal webpage browsing is still OK)

Now clear download history and restart.

Then for another 10 files download will be fine, but later when it reaches 30 or 50 file performance again goes down.

So basically I can not keep download history for ever for future reference and tracking.

Another problem is if I use Firefox to browse JPG photos (of 8 mega pixel) stored on local disk after some 50 files Firefox says invalid image file even for the one we just saw early. Restart Firefox it will be fine for another 50 file, and again the problem starts.

(OS: WindowsXP Pro)

Posted by: BijuGC at February 15, 2006 7:27 AM

@mrdom:

I am cut-n-pasting this from the about:cache page:
---
Key: http://img2.dpreview.com/gallery/canoneos350d_samples1/originals/img_3949.jpg
Data size: 23887872 bytes
Fetch count: 1
Last modified: 2006-02-15 07:21:18
Expires: 2006-03-18 18:40:10
---

Look, 23MB for one stinking image. Those images are huge. I assume this is uncompressed size, which FF uses for performance. Compressed it is 3MB, still big. Basically, what I am saying is, for some usage patterns FF will need lots of memory. There are no two ways about it.

Maybe FF team can find ways to degrade more gracefully, to give better memory feedback to the user so as to inform the user of the real goings-on in order to stop falsely formed bad perception and blame, but I just don't see how FF can process 100 GIG of data on a page without becoming 100GIG in size, unless you use up 100GIG of disk space and constantly load/unload from disk, which arguably is just as bad as having it all in memory.

What do digital photo people expect? :) No seriously, what do you expect? You do know how big the images are if you work with the digital cameras. There is no way you cannot know. What do you think FF should do?

Posted by: Leo at February 15, 2006 7:27 AM

There are a ridiculous number of comments on this page.

Posted by: William at February 15, 2006 7:30 AM

I must really be unusal even tho I'm own the net 5-10 hrs a day. Across any of the three machines Ihave I've never noticed what is being reported -- right now I'm using 36mb-70mb which is a normal for me.
I suspect it's features or extensions combo people use that makes the difference. Also anyone consider the OS and how it handles apps memory use?

Posted by: steve at February 15, 2006 7:30 AM

@leo You got me wrong. I have no problems if firefox uses so much mem when i view the images. I have no problem if firefox says "ooooh this images are too big lets save them on the diskcache". So while viewing the images i expect firefox to take so much mem. But my stats i posted are after closeing all tabs, with a fresh install on a clean profile. So i expect firefox shrinks back to "normal size" and frees the big images in his memcache.

Posted by: mrdom at February 15, 2006 7:30 AM

In the past, I've been using a dedicated RAMdisk to store FF's cache dir to get better performance. Does this mean I should stop doing that, since it's already loading these pages into RAM rather than caching them on HDD?

Posted by: Sanjay Vasandani at February 15, 2006 7:33 AM

Try user_pref("config.trim_on_minimize", true);

See http://kb.mozillazine.org/Config.trim_on_minimize

Posted by: Bill at February 15, 2006 7:38 AM

With the latest versions of Firefox, specially 1.5, we have been unable to use it at work and been forced to change to Opera; our machines are not high end ( we have Pentium II, Celerons, non xp Athlons, etc. with 256 mb ram each one ) but were OK to do some web programming, putty to some servers, use remote desktop connections, etc.

I wish we could still use Firefox, because it is true that renders better tan other browser (altough i think this is due to programmers developing web pages specifically for IE and Firefox...), but the truth is that at least actually, Opera's engine its much much faster and lighter than Gecko's one.

Just my 2 cents.

Posted by: okasion at February 15, 2006 7:39 AM

> See http://kb.mozillazine.org/Config.trim_on_minimize

Already tried. This helps freeing up mem a bit. But once your "storage in use" goes up, this setting has no effect and the memory keeps allocated.

Posted by: mrdom at February 15, 2006 7:42 AM

Well I'm quite tired of people making excuses about this subject. Thanks for the explanation. Now lets fix it.

Posted by: LevelHeaded at February 15, 2006 7:42 AM

@Ryan,

I bet about:cache just doesn't report what we may think. For example, I don't think it reports the fastback cache size. Think about it. Even if you turn off fastback cache, you still are using the plain old cache upon which browser.sessionhistory.max_total_viewers has no effect. Doh. :) I mean FF has had mem and disk cache since Netscape days, yea?

So yes, there may still be a leak, and in fact, Ben says there are leaks in all complex software. But you are not doing a good job arguing for it on your blog.

Posted by: Leo at February 15, 2006 7:47 AM

Leo... FireFox memory usage is also ridiculous...

Posted by: Ripe at February 15, 2006 7:51 AM

At least, Firefox could cache only the compressed versions (.jpg .png) of the images which are not visible ie. images in the background tabs, and decompress them on-demand when the tab becomes visible. This way it would consume much less memory. Considering huge images above, I think that the time spent on decompressing is far more tolerable than swapping. With smaller images, it isn't SO bad if they're kept in decompressed form in the memory.

Posted by: Tero at February 15, 2006 7:53 AM

I'm sorry, when my browser is using 1GB of memory, that means that it is f*ed up.

Posted by: vbrtrmn at February 15, 2006 8:07 AM

I've been a faithful user even before Firefox was known as Firefox. Why does this blog look like this when viewed in Firefox? http://home.comcast.net/~missenid/blogdisplay.jpg

Posted by: Zizzybaloobah at February 15, 2006 8:22 AM

I wish I still had the link but I recall hearing that Gecko uses uncompressed tiles in it's memory cache. This is likely to cause serious memory usage, since uncompressed bitmap images are truly immense. I would not be surprised if storing these images in a compressed format would render all these "serious memory leaks" gone.

I don't doubt that Opera has a faster page-caching scheme. Try queuing up a couple dozen tabs and see how long it takes both browsers to handle them. However, please stop making stupid comments on boards like this; an excellent article like this deserves better than flame wars or "use X even though that is not the point of this article" platitudes. Thanks Ben, you have explained something that I wanted to know for ages.

Posted by: BTreeHugger at February 15, 2006 8:24 AM

People! How on earth is it possible that 8 lousy cached pages take up 500 MB of memory !! The stupid cache can't possible explain that staggering amount of used RAM. Just admit Firefox has serious leak problems.

Posted by: Ignace at February 15, 2006 8:49 AM

""I once had Firefox using more then 800megs of memory with only one window containing one tab open."

I'll see your 800 and raise you to, wait for it, 954MB!"

I'll one-up that. One window, one tab. Flash app. 512RAM all eaten, nearly 2GB page file. And outside of firefox I had no extra apps open.

Posted by: Kitch at February 15, 2006 9:29 AM

sranie w banie...

Posted by: voodoo at February 15, 2006 9:36 AM

I tried doing all the things mentioend above with memory tracking on and could not get over 89mb of memory usage on 1.5.0.1 with about 12 extensions. I am on win xp home with 512mb ram. My Eudora was at about 60mb with 75,000 msgs in 400 mail boxes just for a comparison. I will says the ff is always the biggest user of ram on the list. I also shut off ff numerous times during the day and shut down the computer every night.

Posted by: steve at February 15, 2006 9:54 AM

I don't care what anyone says, I have tried every fix I have found and I still end up REBOOTING my 2GB X2 4400+ every two days because closing Firefox DOESN'T RETURN THE 1.5GB it will eventually use. I have tried limiting tabs, limiting Flash sites, limiting picture sites, NOTHING WORKS. The worst thing is that I am using X64 and IE32 crashes every 5 minutes hwile IE64 has no plugins, toolbars or search.

This is all MS' fault for destroying the retail browser market.

Posted by: BaronMatrix at February 15, 2006 9:58 AM

I agree with the poster above, way above, who said BS. You guys should do spin control for Cheney.
Let's look at some simple FACTS, Opera and IE 7 Beta2 use MUCH less ram than Firefox with the EXACT same pages and tabs open. Why is this?
This is NOT a feature! Especially when my browser hangs while I'm sufing at night catching up on things. Never happens with Opera, only Firefox.
It IS a leak, FIX IT. Stop spinning it.
I actually use Opera more nowadays since it is faster, more reliable, and free now.
Thanks for making FireFox though, it is a great browser, and you have all worked hard on it. Just please be more honest with us users.

Posted by: stehpin_Indy at February 15, 2006 10:28 AM

I'm still using 1.0.6 with the following issues:
* launch without accompanying ui
* memory increase outstripping browser use
* very slow restore from minimise
With any app, I have it loaded for the minimum time necessary to reduce RAM usage because I hate RAM/page file lag.

Posted by: paul1972 at February 15, 2006 10:45 AM

I agree with BaronMatrix. Stop the spinning and fix the damn thing. Firefox is a great browser otherwise but I have to shut it down at least once a day to get my memory back. I'm running with a gig and almost have of it ends up eaten before the end of the day.

Posted by: physio at February 15, 2006 11:23 AM

Uhh, BaronMatrix, hate to tell you, but if you actually close firefox and the memory doesn't return, that's a leak in your OS. ( make sure it's really closed. ).

stehpin_Indy, if you worry about memory usage, turn the caching preference off, everyone wins.

Posted by: dantealiegri at February 15, 2006 12:06 PM

In the spirit of things, I'll raise your 954 megs to... *drum roll* 1086 megs!

This is on a single open window displaying the blank screen of a new tab!

Unfortunately, my computer only has 512 megs of ram. It was swapping at a rather impressive rate.
And this doesn't even mention that it was showing 99% processor utilization to accomplish this perhaps herculean feat. This occured to me on Firefox 1.5.0.1, though i've had similar problems with 1.7.

Firefox is an incredible browser, but it does have its bugs.

Posted by: mossadacity at February 15, 2006 12:17 PM

This is getting silly. I've now seen people blame everything from extensions and themes to the OS and drivers, javascript and now even the users themselves. Obviously your browser is just 'too jam-packed with awesome features!!!11' for users, average and otherwise.

The fact of the matter is, yes, only certain people have problems. Some people seem to have none, which is great for them, but for the rest of us its rather insulting to be blamed for something that has nothing to do with our use of the software or told that no problem exists. Every time I see something about this the responses always tend to be something along the line of 'it must be something you did wrong, because FF is the best browser eva!!!11'

Please.

I've been using firefox for a while now and have gotten incredibly sick of having to restart it every few hours under heavy use. Even the vanilla browser manages to eat up extreme amounts of memory (1.5GB+ pagefile use) after routine browsing and when I close all the tabs it releases NONE of the memory. Yeah, sweet 'feature.' When FF eats up my entire harddrive with a gigantic pagefile and makes it impossible for any other programs to access any memory, real or otherwise, I get a little pissed. There's no reason why this should happen on a regular basis with normal browsing habits. If the browser can't support my browsing habits, you don't have a very robust browser, and blaming me is only going to make me even less willing to use it.

For those who've mentioned opera, I must agree with them. Over the past month or so I've steadily begun to use opera more and more frequently because unlike firefox it won't eat up all of my memory and make my system run dog-slow. Sure, it crashes sometimes too, but at least I can recover from an opera crash in about 10-20 seconds as opposed to the 3-5 minutes I have to wait for firefox to finish crapping out and finally give back some memory. Even IE7 is more usable than firefox for me.

With the offical FF team writing off these problems as 'dumb users' I'm getting more and more tempted everyday to just uninstall FF altogether, which would be a shame. Memory problems aside it's a wonderful browser and by far would be my favourite. Of course, the memory problems are a part of the reality of FF and it makes it nearly unusable to me.

Posted by: Wayne at February 15, 2006 1:26 PM

my 2 cents:

My FF usage on several machines (all Windows 2000) with some extensions the usual load is around 50 - 60 MB.

My normal usage is about 4 - 10 tabs and two Windows (each Windows is a topic and the tabs are my browing on the topic). I normally don't use "back" more than once or twice.

Some times, with each version, I've had FF trouble from websites that start a java applet and have had to use task manager to kill it (and then usually rebooted). This is probably the most usual issue. I'd sure like a "java" block like the popup block to allow selective running of java.

A few websites have had some kind of javascript running that will cause a popup telling me that it is using huge amounts of memory. By that time my computer has a hard time repainting the screen.

I run proxomitron with default filters (except adding a few like sound to links, kill nosy javascripts, and kill onunload). There is probably some more I could do with it, but since I'm shifting to Linux I don't want to spend time on a one trick pony.

I've left FF running idle as long as a weekend and it hasn't seemed to be a problem, but then I reboot every week anyways.

And a few times FF just seems to have freaked out for no reason, but that happens when I've got several windows open with like a dozen tabs each and Windows is already under a load.

So, I can't say generally conclude that the issue is a memory leak, but it does seem to get dicey under Windows or FF are in heavy use.

I haven't used FF under Linux enough to make any kind of observation.

PS. Wow, your comment submission error page sucks for color scheme. Black on dark red. Brilliant design. (that was sarcasm, btw)

Posted by: StephenC at February 15, 2006 1:31 PM

I'm tired of programs (and operating systems) that base the amount of memory they allocate to their cache on the amount of RAM you have in your computer. Imagine if every program I ran used similar methodology. If I left these programs running, they'd consume all of my available RAM. If I have a gig, Firefox thinks it's OK to allocate 25% of that to its own cache (actually, it could be more since it's based on pages with no memory ceiling). So if I keep firefox running, and then launch another memory hungry app, I start to page, simply because firefox wants to make the back button faster. Great logic! In memory caching should be used sparingly. For large data structures like this, use a disk cache and let the OS's filebuffer cache provide the performance boost.

Posted by: Erik at February 15, 2006 1:40 PM

I don't really care what is causing the problem. All I know is that I have 8 IE7 tabs open and 3 Firefox tabs open and IE7 is taking 30MB and Firefox is taking 120MB. And I don't notice any performance difference.

This topic needs very serious attention by the Firefox development team as memory usage brings my Windows system to a standstill.

Posted by: pwb at February 15, 2006 1:58 PM

Ben,

A group of developpers would have claimed that they found a major security flaw within the page caching feature, allowing remote control in Firefox 1.5

Have you heard of this?

Ken Due.

Posted by: Ken Due at February 15, 2006 2:51 PM

Ken, do you mean what you write? It's huge! It would have been already unveiled!

Posted by: sye1567 at February 15, 2006 3:16 PM

I'm tired of programs (and operating systems) that base the amount of memory they allocate to their cache on the amount of RAM you have in your computer. Imagine if every program I ran used similar methodology.

Reminds me of high school. I was absolutely certain that each teacher assigned homework based on the assumption that we only had the one class, and would therefore have enough time to finish the work without cutting into vital activities like getting to/from home, eating, and sleeping.

Posted by: Kelson at February 15, 2006 3:42 PM

One real memory leak is that of X-server-side pixmaps. When surfing lots of image galleries, Firefox easily allocates several hundred megabytes of server-side pixmaps, which don't get freed until the browser is closed. Versions prior to 1.5 at least freed the pixmaps when you closed the tab in which they had been displayed.

Posted by: ilmari at February 15, 2006 4:00 PM

In fact, I think a lot of "memory leak symptom" actually are related to the memory cache.

For my case, I have "fasterfox" extension installed on 2 computers running Firefox, one has 1GB RAM and the other 256MB. With the default fasterfox setting, it will set the memory cache to 64MB, regardless of the amount of physical memory, which is way too high in my opinion for the 256MB machine (1/4 of physical memory). After surfing the web for some time, you will see the "private bytes" memory usage climb up to more than 100MB. It seems the 64MB memory cache is included there. However it seems not much people are aware of this issue, and they are happily using fasterfox.

Posted by: smallpotato at February 15, 2006 5:07 PM

Seems like there'd be some upper limit of memory usage, then. I use FF 1.5.0.1 on a 4GB system, and firefox routintely gets up to about 600MB of memory usage, then bogs down, goes unresponsive, then crashes.

Happens with fresh installs, no extensions, etc. Just browsing for a day or so will do it; maybe 500-1000 page loads.

-b

Posted by: aiken at February 15, 2006 5:39 PM

Being a longtime Opera user on Windows, and having recently delved into the Linux world, iV finally used Firefox 1.5 on Ubuntu.

In my opinion the 'unresponsiveness' of the tabs and back/forward, relative to Opera, is seriously frustrating.

Posted by: Matt at February 15, 2006 6:52 PM

SessionSaver is evil, remove it. I never had a problem with FF until I ran 1.5 (and the 1.5.0.1 upgrade) with SS installed. If you want the same features, plus a whole lot more, try Tab Mix Plus.

Posted by: Douglas Clifton at February 15, 2006 7:36 PM

I think all of you guys should have a look at "about:cache",there're pretty many interesting things there.

Posted by: justkeeper at February 15, 2006 8:07 PM

I think the simple fact that closing tabs does not reduce memory usage its something it should be looked upon.

Also I dont understand the logic behind browser.sessionhistory.max_total_viewers preferences: do you need 64-128 Mb to cache each back-forward rendered page?

Posted by: PA at February 15, 2006 8:38 PM

No extensions, max_total_viewers and max_viewers set to zero, fresh start of firefox, clean profile, mem usage about 29M, after opening several windows and tabs, about 300M.

This is clearly a firefox problem, and it is not a feature. When the usage hits 200M or greater, firefox slows down and becomes prone to crashing. Even if this is caused by a 'legitimate' memory operation, it still needs to be fixed so that it does not detrimentally affect the system (or firefox itself). We're not complaining because it feels good, we're complaining becuase firefox is CLEARLY affecting the system in a detrimental fashion, and that should NEVER happen. Even Internet explorer, the worst browser on the face of the earth, does not cause this kind of memory usage problem. You need to address this issue, not make excuses about it.

Posted by: Gorbnartz at February 15, 2006 8:41 PM

Feature? No, flaw. I know FF developers have a better understanding of what's going on and why the memory abuse can be considered a "feature" but get out of development-land for a bit and come back to the real world with the real users. This is a serious flaw.

Posted by: BobHope at February 15, 2006 11:28 PM

memory problems were solved here
with this in about:config
browser.cache.memory.enable false

Posted by: Joe at February 15, 2006 11:52 PM

I am not sure if this is arrogance or ignorance or just me misreading the whole post but it really does tempt me to switch to Opera. Having used FF from the 0.2 days, I would love not to have to do that but when a developer says something like:

"What I think many people are talking about however with Firefox 1.5 is not really a memory leak at all. It is in fact a feature."

what I read into it is "You users are dumb fools who don't know what you are talking about. I helped write the software and (hence?) there are *no* memory issues with the feature. Nope, you don't matter."

Posted by: Srijith at February 16, 2006 1:38 AM

All you Opera shills that commented in this thread will be interested in knowing that just because of your misleading spam and insults I will NEVER use Opera.

As for the memory leak, I don't get it except for the mysterious 90MB of use once Firefox loads a couple of pages. It never goes back down to the original 30MB or so. *WHAT* is it caching?

Posted by: Osama Bin Kenobi at February 16, 2006 2:54 AM

Like some other commenters I am a tab-heavy user. With versions older than 1.5.0.1 I found that opening a lot of tabs, closing, opening more dragged my memory down.

Small test with the firefox instance I have open now. Memory usage was 50 MB, opened a bunch of tabs, got to 85 MB and then closed them back to the tabs I had open (4), memory usage didn't go down further than 70-75 MB (seems to fluctuate).

Makes you wonder where the 20-25 MB went to.

Also, testing with Purify doesn't make you happy, apparently the Javascript support part leaks like crazy, and funnily enough, all bug reports containing purify logs and the likes are sitting idle for long, long periods inside the Bugzilla database.

Posted by: Jeroen Ruigrok at February 16, 2006 5:01 AM

All of you who blame Ben for seeking excuses for the Firefox memory leak should read the article twice.Has he ever said that Firefox has no memory leak problems? The second sentence he wrote starts with "All versions of Firefox no doubt leak memory ".He was just giving suggestions about a possible solution to some of the users' problems.What's wrong with that?

Posted by: justkeeper at February 16, 2006 5:24 AM

I just have one serious question about memory usage for all you Firefox fanboys: if Firefox is so great, why can't it bring me my coffee in the morning, like Opera does? Or wipe my ass after a particularly nasty dump like Opera (and, sometimes, Andrew K aka Mastertech http://www.populartechnology.net/) does? Stop avoiding the real issues and answer these serious charges.

Andrew the 3rd

Posted by: notlikely at February 16, 2006 6:03 AM

This 'feature' has been a problem for me for some time. At one point I made the mistake of adding a new partition and not updating my fstab (we're talking Linux here) resulting in no swap partition. This meant that as Firefox built up its memory usage the physical memory would top out and my XServer would be killed automatically.

I have reconfigured now (I'd been lazy before), but Firefox will still build up memory usage to a ridiculous figure. I have closed tabs down to a single tab and seen no improvement in memory usage. I have then closed Firefox completely and watched my swap usage drop from close to topping out on 512M to 32M, and my physical memory drop from close to topping out on 1G to around 200M - so not too far off 1.5G of usage!!

Feature or not this is not working in the best manner. I will be trying this 'fix', but for less technical users and those that just stick with the default installs something needs to be done as the number of people using Firefox increases. Perhaps an option somewhere should be added, and I would suggest disabled by default.

I've noted the amendment that details 8 pages across all tabs, but I would consider that either the original statement was correct, or there is something else in there. Oddly I've not noticed the problem with the Windows version, but then I'm far from being a heavy Windows user and this shows up most when I've been using Firefox for most of the day or longer - I can't stand using Windows that long in one go :)

Posted by: Paul Tansom at February 16, 2006 7:02 AM

I have seen memory usage for going high, when i open up a page which uses lot of ajax features for e.g. www.netvibes.com or Google customized page like www.google.com/ig with lots of RSS feed on the page. Every time you reload the page, the memory usage goes up and never goes down even if you close the page. This is despit the settting browser.sessionhistory.max_total_viewers = 0 I think somehow the httprequestobject consuming lot of memory.

Posted by: Ketan Kothari at February 16, 2006 8:10 AM

Obscurely enough, especially for those that claim to have had previous wisdom and throwing the 'ídiot' idiom around (and surely not knowing much), this browsing feature has only minimally changed the memory usage since e.g. 1.07. The last record observed is 310mb in 1.5.01. Where in past minimising ffx would return a lot of that back, the 1.5 and up does barely.....this I consider wholly incorrect. If I minimise it, since it takes ages to load compared to IE (6 or 7) or Opera, it should be relegated to disk page +/- features like running the radio e.g., but surely no need for keeping all those pages ready in Ram. Thus, there should be some memory options.....the tip on the full cached pages in ram is great and changed it to 3, for that is practically how far I usually go up and down...else, I think a more optimised use of the classic page cache (or buffer as the moz boys call it)....I barely see difference with Opera going up or down, thus there is an extremely and not to be wiped off the table question!!!!! BTW, how do we get from 64mb with 1 page render ready to 512mb at 5???? Also, comments like 'unused ram, is wasted ram' is an another 'brillaint' comment....maybe one from a browser/gamer only user? I agree with the real question posed several times and still left open: what's on and when is the leaking remedied? If ever there is a wish to enter the big stream business world user realm, where browsing is not the only thing done, it needs resolution. Today, i think its great for home, but i would not entrust it onto a business PC.

Posted by: sekerob at February 16, 2006 10:59 AM

In my opinion, this is still a memory leak, albeit in a different sense. If I close a tab, I don't expect to be able to get back to that page without a fresh page load. I'd much rather see a session-per-tab algorithm, with separate caches. Then when a tab is closed, no memory associated with that tab remains allocated. That seems to be the source of the confusion - people close a tab and memory is still used by cache for pages that are presumably done being viewed. The algorithm needs to change to match the user paradigm.

Posted by: Andrew at February 16, 2006 11:19 AM

>> BTW, how do we get from 64mb with 1 page render ready to 512mb at 5????

This was explained at least twice in these comments. As well as in the paragraph 0.5cm above that table. You _can_ read, can't you?

Posted by: ant at February 16, 2006 11:25 AM

I tried setting the
browser.sessionhistory.max_total_viewers
to Zero.
Then I closed firefox (1.5.0.1 Windows XP) and opened a bunch of windows and a whole bunch of sites in tabs. Memory usage = 252MB.
I closed ALL the tabs except one (which was blank - no url). Memory Usage 127MB.
Better, but still no cigar. What's it holding that 100MB for? When I open Firefox (empty url) it uses 29MB. (Which is still inane, but acceptable). That 100MB is not a "feature"
Letting Firefox suck up memory without bound is not a feature. It's called SUCKING.
I use Firefox, but I'm actually hoping IE 7 is good, because IE 6 uses FAR less memory than Firefox. And it performs better on many pages too.
I'm no MS Lackey, but I think the Firefox guys forgot when they branched off of the Mozilla suite they were going to make something light weight.
Remmber. Light weight? That means you don't suck up memory infinitely.

Posted by: Max Rockbin at February 16, 2006 11:47 AM

Actually "light weight" means not supporting two whole image formats to make the download 50KB smaller.

Posted by: ant at February 16, 2006 12:02 PM

Okay, I'm not going to debate with 'you can read' commentators...adding from 256mb to 512mb limiting to 2 extra pages gives away a scary indication of the memory hog hiding within? Why do I think that regardless if one calls it tabs or windows, in reality each tab loads a complete Firefox (I see it being done all the time, new window opened and then converted to a tab in the original window). Why do I think that the 'tab close undo' is (partially) responsible for not giving back memory? Cogito ergo sum.....reading between the lines can be learned too!

BTW I hard set the pref from Ben to 3 after which memory usage dropped to 134mb, without closing ffx! Now that was a very useful tip not impacting my browser habits AT ALL!. Think the options screen definitely needs a 'memory management' tab...I'm sure someone is going to tell me there's an extension for that ;>)

Posted by: sekerob at February 16, 2006 12:13 PM

Firefox 1.5.01 Release Notes: http://www.mozilla.com/firefox/releases/1.5.0.1.html

Here's what's new in Firefox 1.5.0.1:

* Improved stability.
* Improved support for Mac OS X.
* International Domain Name support for Iceland (.is) is now enabled.
* Fixes for several memory leaks.
* Several security enhancements.


It was a memory leak, thankfully the mozilla dev team plugged the main leak, no more whi