Firefox Memory Usage

First, while I do create some software, I am not what should be called a developer. I don’t have the experience.

With that out of the way, it seems to me that Firefox (1.0.3) is using up a decent amount of memory on my (Windows XP) system. When it first starts, it uses perhaps 18MB. Within just a few minutes, it’s at 20MB – not a huge jump, but a jump nonetheless.

Earlier today I noticed that things were running slowly and I fired up the Windows Task Manager. Firefox was using over 120MB. Now I had not logged off or even restarted Firefox in probably a week. I just leave it running. I also had probably 15 tabs open.

As I started closing the tabs, the memory usage really didn’t change. There may have been some adjustement, but nothing significant. This would normally lead me to believe that tabs don’t matter much, if at all. When I finally closed Firefox, that memory was released. Starting up again, it’s now back around the 20MB figure.

It’s certainly possible that something on my system is ill- or mis-configured and causing the problem, but I’m not sure where I’d even look, as the memory appears to be allocated to Firefox alone. It could, perhaps, be the Bloglines Toolkit (or some other extension), but short of uninstalling it I’m not sure how to test that (I will uninstall it to see if it helps). And more specifically, if it is the issue, I’m not sure how to address it.

So I’m wondering if any of you have seen similar behavior, either with or without the Toolkit or other extensions?

Update: In a quick test, I disabled the Toolkit notification, then disabled the extension entirely, so it should not be running. Firefox appears to periodically add 8K or so to the running memory, even without the Toolkit. I’m not sure what this is, only that it does appear to happen from time to time. It doesn’t appear to be the Toolkit, though, and for that I’m grateful.

Then I started testing. A fresh load of Firefox, using the local paper, started at about 21MB. This size varies a bit depending on the size of the page you load, but seems to be relatively consistent if I load the same page over and over again for testing.

In any case, those values seemed consistent. So I started adding tabs. I chose this article, just because I happened to find it interesting. Using the Firefox “Page Info” option, it shows the page as 11K. When opening this page as an additional tab (leaving the front page in the other tab), the memory usage jumps up by about 3MB. Opening another tab with the same size results in sizes of 1.4MB to just over 2.0MB for each tab opened.

Those are reasonable numbers – I have no problem with the size in general, as I typically only have a few tabs open, so the footprint is still small – about 31MB in this example, after having the front page and five copies of the article open at the same time (6 tabs total).

The problem seems to come on closing those tabs. I closed all five of the articles, and the memory savings was just over 1MB. So while opening those five tabs added about 10MB to the memory used by the application, after closing those five tabs, just 1MB was released, leaving a net gain of 9MB for no effective difference after closing those tabs!

Update: For comparison purposes, I tried the same test in IE (using windows instead of tabs, of course). The first window was smaller than Firefox – about 19MB compared to 21MB. Small savings, but interesting to note.

The next window added nearly 13MB of memory – all the way up to 32MB, which immediately places it higher than Firefox with all 6 tabs open. Each of the final four tabs required 1-2MB, for a final footprint of just over 38MB. So it ends 8MB higher than Firefox. If you open a ton of tabs/windows, then this could be a reasonably significant number.

Then I started closing windows. By the time I was back down to a single window, I was running with 23MB – just over the initial size. So while IE added 19MB of memory to the running instance, it also released all but 4MB of that after the windows were closed, and perhaps more importantly, the total size after closing those extras was just 23MB – compared to Firefox at 30MB.

Opening the extra windows again resulted in a higher memory footprint at the end, but it still seems that IE is releasing most of the extra memory used, while Firefox is keeping it. More as I play with it some more.

Update: After observing this behavior for a couple of days, I can say with certainty that Firefox does not immediately release the memory in use by those extra tabs, while IE does (for windows). However, it does seem that Firefox will release at least some memory periodically, as I have seen an instance of Firefox go from 100MB to 80MB with absolutely no change in the number of tabs (or even the URLs open in those tabs). So I’m not sure how, but it does seem to free up memory from time to time. Just not immediately.

32 Replies to “Firefox Memory Usage”

  1. Definitely firefox eats up memory like no tomorrow. The moment i kill firefox rest of my apps seem to get a new life. Opera is definitely sleeker and faster. When i open firefox its like ok here i go i’m taking this bulky truck for a city drive while opera is like a spin in a german sports car. Now only if the web was as strict as opera.
    I’d rather looking at the cyber world thru the windsheild of my sports car. the truck can go to hell….

  2. “is anyone experiencing REAL memory problems, i.e. increased swapping activity of the OS and/or application slowdown?”
    YES! My computer has 256MB of RAM, and when Firefox is open, I sometimes have to wait for 20 seconds for things to be paged in and out. Windows pops up error messages saying it needs to increase my virtual memory size. Once I close Firefox, everything is fine. If Firefox uses some sort of adaptive technique to free the memory cache, it is very broken.

    If you minimize any Windows application, the memory usage drops drastically. I don’t know if this is due to programs being swapped out to virtual memory, but I would guess that it has to do with the Windows memory manager, not with the application.

    Not all of us have the resources to go out and buy a new RAM chip so that we can run bloated programs.

  3. One small note about folks wanting to block flash: you can actually insall “AdBlock” then just add a filter for any file with a .swf extension, and it’ll do that. From what I’ve read, AdBlock actually gets the plain HTML page, and before loading images or anything else, checks for ads, so this means it would block the flash before downloading it.

    If you have the Filterset.G updater, that might be a problem, since it may override the flash blocking rule you define when you do an update. I wouldn’t know for sure, sinceI’ve found JavaScript to be far more the problem.

    Also, if memory is really that critical, you COULD disable JavaScript alltogether. It’s actually an option in the options window you can check. It actually works with GMail, too, if you use the “Plain HTML” view, but GMail won’t let you chance your GMail Options in the Plain HTML view. Just a thought 😉

  4. Good points, to be sure. And since I’ve upgraded to 1GB of RAM, I don’t have problems even though FF is regularly at 300MB or more.

    But at 512MB and below, Firefox used up enough that other applications started slowing, presumably because of increased page file swapping.

    Also, I rarely minimize things – it’s quite possible that this strategy alone could help. I just don’t often take the time to minimize something – I just pull up something else.

  5. Having seen the list of memory “problems” with FF, I like to ask: is anyone experiencing REAL memory problems, i.e. increased swapping activity of the OS and/or application slowdown – or are you all just looking at the task manager’s process list?

    I would be surprised if anyone is experiencing memory shortage due to FF usage.

    The reason is that FF’s memory allocation strategy tries to utilize as much unused RAM of your computer for in core page cache as possible. When other applications are eating up free RAM, FF releases pages from its cache to satisfy those applications. I.e. FF’s in core cache is never swapped out to and reloaded from hard disk. So no memory problems.

    This is intelligent memory usage. You do not want unused ram. Unused ram does not serve you anything.

    The minimum resident memory footprint of FF is around 8-9 MB (while open) – that is below the memory footprint of a fresh opened IE. It almost completely removes itself from the core if minimized.

  6. Here is one (at least temporary) fix to get FF (and all of your other programs) to release a bunch of your memory:

    http://www.majorgeeks.com/download.php?det=2913

    It is a program called Ramfreer, and basically it (in my very non-technical description) steals all of the unused RAM into its own program (you can see this by looking at Task Manager at the same time as running it), and then releases it all. It is the only way I can keep my laptop running for weeks on end, I run it every day or two.

    With FF, it seems to free all memory that has been grabbed and not released from closed tabs and windows, and temporarily releases memory grabbed in current windows. But the second you use FF again … oops, there goes your RAM again. Hope it is useful to somebody. Cheers

  7. You should learn about virtual memory a bit. What you are looking at is only part of the picture – physical RAM usage. Virtual memory consists of ‘pages’ of memory in both physical RAM and in the swap/page file. You can add to task manager a column indicating the amount of page file; simply add the ‘Virtual Memory’ column. This amount + physical RAM usage is the true amount of virtual memory the application is using. This is how Firefox ‘releases’ memory suddenly – it is paging it out to the swap file, not magically freeing it. Anyway, too much to describe here, please do research so you know what’s up. I don’t disagree that Firefox’s virtual memory usage is excessive, I just wanted to clear things up.

  8. Same problem here on my gentoo amd64 system. 250MB and more in use by FireFox. Only restarting FireFox will free the memory.
    It is a big problem, i have only 512MB atm, and HD-Swap slows down my system in al little while.

    But i am sure, the developers will fix this problem soon.

  9. I watch my computer like a school nun with a bull whip and a bottle of gin and I must say I feel increasingly concerned about the memory issues (whatever they may be) with Firefox. I have the same stuff open in Opera and it’s not even touching 6mb while Firefox is just over 30. The GUI and key extensions (adblock for example) are what make Firefox my browser (other then testing purposes). I’d like to see this resolved myself but I barely know serverside web programming. I do know if you want bad code go to 99.9% of the websites on the internet.

    JAB

  10. This is not perfect but it ALWAYS works (on Windows)… get Firefox Preloader. It is free. It preloads Firefox into memory, and puts a handy icon in the Notification Area (by the clock).

    When Firefox has blasted away at your RAM, and you have already closed all Firefox tabs and windows and the RAM is still being used, right-click on Firefox Preloader, select Reload Firefox, and sure enough it automatically kills the process and reloads Firfox into RAM — using minimal memory.

    You also get the benefit of Firefox Preloader — it loads MUCH faster!

Comments are closed.