Elliott C. Back: In Aere Aedificare

Firefox Memory Leak

Posted in Spread IE, Browsers, Uptime, Performance by Elliott Back on February 20th, 2007.

Hi, my Firefox (the latest public version 2.0.0.1) is leaking memory. I know that you think you’ve heard this before and that it’s extensions, or old version, but seriously this has to stop:

Fixed! Removing the Firebug extension completely solves the problem. I don’t know why Firebug leaks memory, but trust me, it does.

firefox-memory-leak.jpg

Yup, it’s using 623MB of memory. Opening a new tab is visibly sluggish. Closing a tab, clicking on links–every action takes seconds to perform on my Core Duo 2 6600 processor with 4 GB of RAM. Extensions? I’m running two: Firebug and an S3 attachment:

firefox-extensions.jpg

The secret Firefox memory cache page (about:cache) returns nothing out of the ordinary:

Number of entries: 1114
Maximum storage size: 28672 KiB
Storage in use: 75316 KiB
Inactive storage: 0 KiB

I have no idea what’s causing this behavior, so I’m going to ask for help. Digg this and let the world know Firefox *still* has memory management issues.

This entry was posted on Tuesday, February 20th, 2007 at 11:21 pm and is tagged with memory management issues, storage size, firebug, maximum storage, memory cache, memory leak, old version, leaks, firefox, kib, 4 gb. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback.

23 Responses to 'Firefox Memory Leak'

  1. LocalH said:

    on February 20th, 2007 at 11:49 pm

    Sorry about that, there was a left angle bracket in the text that caused the blog to clip it. Here it is edited to "less than":

    To improve performance when navigating (studies show that 39% of all page navigations are renavigations to pages visited less than 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:

    32MB - 0 cached pages
    64MB - 1 cached pages
    128MB - 2 cached pages
    256MB - 3 cached pages
    512MB - 5 cached pages
    1GB - 8 cached pages
    2GB - 8 cached pages
    4GB - 8 cached pages

    (lxr.mozilla.org/seamonkey/source/docshell/shistory/src/nsSHistory.cpp#161)

    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.

  2. Elliott Back said:

    on February 21st, 2007 at 12:01 am

    Yeah, that should add a constant overhead of 32mb. I’ve got 600+mb. Explain.

  3. Dossy Shiobara said:

    on February 21st, 2007 at 12:14 am

    Elliott:

    Thanks for pointing out about:cache. Didn’t know about that.

    Looking at the data on about:cache, it looks like it measures the cache size’s "in use" using the byte size of the original asset–but in the case of compressed assets (JPEGs, GIFs, etc.) it keeps the uncompressed data around in memory (have to verify this in the source). 32 MB cache of JPEGs coulud very easily be 600 MB worth of uncompressed image bits.

    If this is the case, this is one ****** cache management implementation.

  4. Cibbuano said:

    on February 21st, 2007 at 5:37 pm

    I’ve had the same problem with Firefox ever since ver 1.0. I’ve heard all the smoke waving, ie extensions, raw image storage, but I’d rather that the problem just go away.

    I can’t go back to IE, though. Firefox is like a new, shiny Leatherman, and IE is more like a rusted hammer that you use to open cans of paint.

    My solution? I use Firefox all day, and close it at the end of the day.

  5. hl said:

    on February 24th, 2007 at 5:04 am

    visiting certain types of pages on one tab will cause a global cpu leak across firefox. it might be from flash or java or something else, i don’t know

  6. SimonB. said:

    on February 27th, 2007 at 6:26 am

    You could try installing the plugin "Nightly tester tools" and check the Leaklog , found in menu Tools - Nightly, or use this link:
    chrome://nightly/content/leaks/leaks.xul

    I’m not sure which kind of leaks are tracked on that page though.
    I had a bunch of crashes on Firefox 2. Never any on 1.5 or old Flock, so I’m suspicious that some recent features/changes that came into both Flock and Firefox should take the blame.

  7. mupo said:

    on March 6th, 2007 at 4:01 pm

    I have the same Problem, even after some tunings in Firefox.

    The Problem in my configuration is Firebug!

    After the first start of Firefox it uses 60 MB.
    But then it is growing and growing, after some hours it uses 300MB and more, maybe Firebug is logging every action and so on?

    But disabling Firebug solves the Problem. It must be a bug in Firebug.

  8. alan said:

    on March 13th, 2007 at 3:02 am

    i find it’s GMAIL leaking memory in this fashion. if I open Gmail in Explorer then Firefox runs like it should.

  9. Dravu said:

    on March 13th, 2007 at 10:34 pm

    Firebug has a major memory leak that has yet to be found. Like now for instance, I have Firebug enabled and FireFox is running on 160mb of Memory. But when I disable Firebug or uninstall it, I never have the memory leaks. It stores so much data on every page you view that after awhile of navigating and especially using tabs or looking at resource intensive pages, the memory just gets eaten right up. So even if you load a blank page, that Memory is still used up and won’t get freed until you kill the process. =/

  10. Kashif said:

    on March 14th, 2007 at 10:06 am

    How about restricting cache memory capacity. I have set browser.cache.memory.capacity to 16MB

  11. dror said:

    on March 20th, 2007 at 8:14 pm

    It’s firebug. I have the same issue. With firebug enabled it grows to 500-600Megs.
    With firebug disabled it stays around 200-300 Megs. I open and close tons of tabs. I might have 40-50 tabs open at one time.

  12. Your Face said:

    on April 1st, 2007 at 1:50 am

    Funny. I’ve never had anything like that happen. Firefox 2.0.0.3 on my Linux box has been open since the 21st and is currently taking up ~60 MB (including swap).

  13. Brian said:

    on April 18th, 2007 at 3:24 pm

    I’ve been tearing my hair out for the past week trying to figure out why my Firefox 2.0.0.3’s footprint keeps growing. Finally widdled it down to Firebug today (through my own trial-and-error) and I’m glad to see I’m not crazy.

  14. Walt Collins said:

    on April 20th, 2007 at 5:39 am

    Thanks for the tip about uninstalling Firebug. It seems to have really helped me so far.

    Prior to removing Firebug, my solution to the Firefox memory eating problem was/is to do this:

    1. Set my Firefox Option (on the Main tab, at the top) to: When Firefox starts “show my windows and tabs from last time”. This is a standard feature of Firefox.

    2. Install the Restart Firefox plugin.

    3. Whenever I notice that my system is sluggish, just restart Firefox. It basically does an in-place restart of all my tabs, seamlessly. This dramatically reduces Firefox’s memory footprint, only takes half a minute, and replaces everything I was doing including web form content and authentication.

    I can’t find any downside to this approach, so I’m quite happy to recommend it.

  15. supplex said:

    on June 1st, 2007 at 6:21 pm

    you guys never heard of Opera?!

  16. Evgeniy Sinev said:

    on July 18th, 2007 at 4:37 pm

    I increase cache memory for firefox and firebug does not eat many memory.

    This is top output:
    PID USER PRI NI VIRT RES SHR S CPU% MEM% TIME+ Command
    5148 esinev 15 0 272M 195M 24464 S 0.0 5.0 13:40.38 /opt/firefox/firefox-bin

    prefs.js
    user_pref(”browser.cache.memory.capacity”, 100000);

  17. Tanner Brockwell said:

    on August 15th, 2007 at 9:41 am

    Heya! wow Firebug is the culprit? I’ve just disabled this extension, I need, need, need fast tabs, and the slowness in opening new ones with CTRL-T is driving me crazy. I will start typing the url, and loose the first five or six letters. ugh

    I even downgraded to 1.5 but left firebug active, now i’m uninstalling firebug I hope this works.

  18. Mark Peterson said:

    on September 1st, 2007 at 10:40 pm

    Though I won’t be removing firebug anytime soon, it’s by far the best tool for creating non firebug related memory leaks, I’m glad to hear that others are experiencing the same problems.

  19. Mark said:

    on November 29th, 2007 at 2:52 pm

    It was gmail for me - can’t have the thing open five minutes before Firefox is page faulting by the million. Run it in IE - no problem at all. I can’t remember which version of Firefox this started happening with, but a while ago I’d get the occasional ’script misbehaving’ message. Now I can’t use gmail at all. I can’t go back to IE, so it looks like Opera, here we come.

  20. […] I searched and even this article was not able to help till much extent. Starting firefox will take the memory usage to 60k memory . I dont know why !! Anyway Elliott found his problem fixed by uninstalling firebug and I was also left with no other option other than doing the same. I can say that it has improved my system performance to some extent. Keystrokes takes no more seconds to get identified. May be I will install firebug next when i will be developing my own theme now. Till then I am sticking to this 3column Pressrow theme. […]

  21. JJ said:

    on January 18th, 2008 at 1:32 pm

    I have also had this same problem and I’m pretty sure that firebug is the issue. This issue is also documented here:

    code.google.com/p/fbug/issues/detail?id=127&can=4&q=

    I personally can’t live without firebug, so I suppose I’ll just have to restart firefox now and then.

  22. stone said:

    on March 17th, 2008 at 2:24 pm

    Why there always should be one idiot mentioning Opera in Firefox blog?

  23. Greg said:

    on May 23rd, 2008 at 4:24 pm

    I don’t even know what Firebug is, and hence do not have it installed, and my Firefox has blossomed to 1.2 gigs!

Your Thoughts Go Here:

Powered by WP Hashcash