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. Son Nguyen Avatar

    Same problem here, it’s a memory hog. I think FF developers should take care of this problem (optimizations) before adding new features, which just gonna make it worse.

  2. Nahel Avatar
    Nahel

    FF uses so much memory on my system. Within an hour of surfing the net I can see it choking my computer. FF is good, but this is a BIG issue for me that needs to be resolved. And yeah what’s with the startup time? IE opens up much more quicker.

  3. Andrew Lawlor Avatar
    Andrew Lawlor

    This problem has been bothering me for a while and I’ve found no good resolution. I started to suspect my PC was the problem until I did some googling.

  4. IUSR Avatar
    IUSR

    Good luck, then…
    Hope we are lucky enough to avoid loading those flash movies once and once again…
    Maybe you can improve FlashBlock?:^)

  5. Chad Everett Avatar

    Javascript could indeed be causing issues. Flash as well. And I use FlashBlock. I love it. The problem is that it still loads the flash. It just doesn’t display it. I’m sure there is some memory savings there, but it’s not like the flash is completely non-existent…

    In any case, I have some memory chips on the way, so it won’t be an issue for long.

  6. IUSR Avatar
    IUSR

    “Just as a guess, I’m going to bet that at least one of the pages you visit uses a lot of JavaScript.” Agreed. And “Mozilla should find a way to resolve the JS leaks” is rather thoughtful, but indeed hard to implement. Ah, surely I’m not one of the Mozilla developers, so maybe some day it could be fixed:)
    However, monitoring the memory usage and leaks of a page’s javascripts may result to eating more memory and CPU usage, because that’s not an easy and costless job, just take a look at java.
    Meanwhile, besides javascripts, Flash and big moving pictures are eating your RAM, too. Some months ago I found that the “modern” flash movies costs too much to display, and often I found them only ads at last, so I installed 2 extensions: FlashBlock and NukeAnything. Hope they can do something on your browser:)

  7. Brandon Avatar

    I’ve noticed the same thing on my computer. I’m running 1.0.3 on XP. I have a dual athlon 1900 w/ 512M RAM.

    Usually FF gets to around 120M during the course of my normal browsing, but sometimes it uses more, and I have to end the process. I just tried changing the ram cache setting to 16000. I managed to get memory usage up to 80M by opening 15 tabs. When I minimize this tabbed window, it goes down to around 10M instantly, and climbs back to around 30M in the next few seconds. When I maximize the tabbed window, it climbs to around 40-50M. I clicked on each tab to make sure each site was loaded. It went to around 60M. Next I closed each tab, and with one tab remaining it used around 40M. I just loaded 13 bookmarks into tabs, and it is still around 40M.

    From my short informal tests, I think lowering the memory cache has reduced overall memory usage when using tabbed windows. Minimizing a window that is using memory seems to release some memory. What I am curious about is why Firefox would cut it’s memory usage in half simply by minimizing and maximizing a window. Clicking on each tab is very responsive, much more so than when it was using 120M.

    Perhaps Firefox should run the garbage collection routine periodically, freeing memory from tabs that haven’t been viewed in a while. The installer should set the memory cache based on the amount of system RAM.

  8. Me Avatar
    Me

    Do a Google search and you’ll see this is an issue for many folks. There’s some suggestions for setting the cache size that helps, but in general you’ll still find problems. Just as a guess, I’m going to bet that at least one of the pages you visit uses a lot of JavaScript. Possibly even Gmail. If that’s the case, the culprit is likely the page your visiting, and not Firefox’s (at least not directly). Google on Mozilla and JavaScript leaks and you get the skinny on what I’m referring to. That said:

    Mozilla should find a way to resolve the JS leaks. Yes, it’s technically an issue with the page and not the browser, but the browser’s GC shouldn’t be allowing this to occur in the first place. Difficult thing to fix, but they need to put some emphasis on it. IE has similar issues, but it seems to have far less “in practice” problems with this, for what ever reason.

    It’s my experience that Mozilla’s products have several leaks beyond the JavaScript leaks. Not as bad, certainly, but they need addressing as well.

  9. Paul Moore Avatar

    I don’t know if you have already done this, but I’d suggest raising a bug for Firefox. I’d like to think that they’d fix something like this if they got complaints…

  10. Ted Avatar

    There is a technical term for that. It’s called being a pig. I thought only Microsoft apps were pigs. Run SQL Server. It’ll eat its way through most of your RAM up to 2GB. It’ll actually steal from the OS. But you can restrict it.