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.


Posted

in

Comments

32 responses to “Firefox Memory Usage”

  1. koolman Avatar
    koolman

    what i dont like is that firefox is running and so is iexplorer at the same time. fire fox is at 20 megs right now but iexplorer (which i dont have any ie windows open) is running at 15 megs and there is another ie running at 7 megs. now ff is at 20 megs (cuz i opened this comment window). why is it that ie is running when i have no windows open!

  2. Keith T. Avatar
    Keith T.

    Try turning off prefetching:

    Open “about:config” and scroll down to “network.prefetch-next” and double click the line so the value on the right says “false”.

    Seems to cut FF’s memory usage for me down to a more reasonable 30M, instead of 130M.

    Didn’t old Mozilla have a memory cache size setting? Why didn’t FF keep this?

  3. Thomas Avatar
    Thomas

    Running Firefox on Linux for the past few days, it just hit over 1 GB – yes, GB – in memory usage. That’s not even adding the X server memory it uses. I’d say I was running about 10-15 tabs. It really seems unacceptable to me, I hope something can be done!

  4. Peter Avatar

    Firefox has a bad memory leak. There is no work-around, other than to close all browser windows and start over.

    Unfortunately, well-intended people keep posting a bogus fix that involves setting browser.cache.memory.capacity to 16 MB. It simply doesn’t work.

    I wish the Firefox builders, bless their hearts, would listen up, track the problem down and fix it.

  5. Daniel Mullowney Avatar
    Daniel Mullowney

    I’ve been experiencing similar problems with FF. When first loaded it has a relatively small footprint, but as windows are opened it quickly bloats up to around 70-80MB (of the 512MB) in the computer. Minimizing all FF windows causes this to instantly drop down to 5MB or less which then quickly climbs back up. Something special is happening when a window is minimized and I’m not entirely sure what. But I’d like for FF to use a more reasonable amount of space (or at least hold onto a consistent amount of memory for the given loaded pages).

  6. Jynx D5 Avatar
    Jynx D5

    Christiaan, I’m really sorry but I just broke your record. 428MB is what I got with only 4 tabs open, all on the same site. I started from scratch and visited no other sites besides Google, which is my home page. The site has no external links, no ads of any kind, no java, no scripts, no flash, just plain html with jpg images. I’m running 1.0.4 on Win XP Pro with 1GB RAM. I’m gonna try the tweak suggested by Amit and see if it helps.

  7. Christiaan Avatar
    Christiaan

    Haha seems i have the record, firefox used around the 290 MB on my system. It looked like it has something to do with the download manager.

  8. Tek Avatar
    Tek

    And after all this time I thought I was the only one?!

  9. Amit Chakradeo Avatar

    Go to about:config, create a new integer browser.cache.memory.capacity which will limit RAM cache to the specified value (in kilobytes). Restart browser to see its effect. After doing this, the memory usage also seems to drop considerably by minimizing the firefox window…

  10. Nick Avatar
    Nick

    The reason IE opens so fast is because in a sense it’s always running. Look at your running processes and you’ll see explorer.exe running all the time. Thats a big part of IE and also a big part of Windows, which is why IE can’t be uninstalled (atleast not officially) from Windows.