Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

When I start Firefox, I have no problems for a while, but after a couple of days, CPU spikes start to occur. During a spike, Firefox freezes and then stops. Spikes occur every seven to ten seconds, and each spike lasts for two to three seconds. If I am typing when a spike occurs, characters output only after the spike. I initially thought this problem was because of Flash, so I disabled it, but the problem still occurs.

Also, Firefox's memory usage increases to over 600MB after several days.

The list of Firefox plugins and extensions I use is available here.

share|improve this question
4  
Firefox has always had memory leaks, that part is normal. –  John T May 27 '11 at 15:42
    
The symptom is tracked in bug 490122. I don't seem to experience these in Firefox 4+ anymore - thankfully. –  romkyns Sep 25 '11 at 16:38
    
And every new version they promise they've fixed it! google.com.au/… –  Matthew Lock Jan 13 '13 at 6:06
1  
@MatthewLock What about this? It seems only users on Reddit feel like this gets addressed every version... –  Daniel Beck Jan 13 '13 at 11:54

5 Answers 5

up vote 5 down vote accepted

I suspect it is either the Garbage Collector or the Cycle Collector.

In about:config change javascript.options.mem.log to true. Now notices about GC and CC should be available in the Error console (Crtl+Shift+J) If their timing and duration matcher the freezing, then this is your problem.

When I had this problem I fixed it by blowing away my Firefox profile and creating a new one from scratch. The Firefox profiles have a tendency to gather a lot of crud over time.

Even this is not a prefect solution. If you open a lot of tabs in Firefox (100+) or lots of extensions and leave Firefox running for days on end it will inevitably slow down. You will need to restart Firefox every once in a while.

If you are like me and have a tendency gather a large collection of tabs you need get around to dealing with at some point another trick I use is to set browser.sessionstore.max_concurrent_tabs to 0. This will stop Firefox from loading all the tabs of your session when starting. It will instead load them when you switch to them. I find this, plus the occasional restart of Firefox, greatly reduces the load of having a great many tabs.

share|improve this answer
1  
There is Firefox plugin called BarTab. I assume it does same thing about browser.sessionstore.max_concurrent_tabs –  Boris_yo May 27 '11 at 14:24
    
Yes, although I believe it is not updated for Firefox 4. –  Mr Alpha May 27 '11 at 15:25
    

Very difficult to tell. Is it just general use that causes it, or are you accessing a specific site? (We had a problem where a browser gained memory over time because of a memory leak in jQuery).

Assuming you're using a Microsoft OX, you could try using Microsoft's Process Monitor tool. It spits out shed loads of messages, but you should be able to narrow them to the interval where the 'freeze' occurred, and maybe see what process is doing the blocking.

share|improve this answer
    
jQuery can have a memory leak? Hrmmmmm –  Jeff F. May 27 '11 at 13:38
    
It can happen. See this list of jQuery bug tickets: bugs.jquery.com/search?q=leak&go=&ticket=on. We encountered because we were constantly hitting a single page (through an AJAX request triggered at an interval) that precipitated a fairly large leak. –  James Wiseman May 27 '11 at 13:47
    
Sounds more like a browser issue and less of a jQuary issue is what I'm saying since it can't run but in a browser(well for most cases anyhow) :) (if while(1==1){} crashes a browser I blame the browser :P) –  Jeff F. May 27 '11 at 13:53
    
While you are correct in asserting that the browser is at fault (some of the bugs on the above link were related to IE's failure to properly handle circular references), there are steps that a developer can take in their JS code to ameliorate these issues. In C/C++ you have to clean up memory you have manually allocated as there is no GC for you to do this. If you don't is this a fault in your code, or the runtime? I would argue that not accounting for the limitations of your environment can be considered a bug on your behalf, and it looks like that's exactly how the jQuery team view it too. –  James Wiseman May 27 '11 at 14:02
    
Well this ended up in a silly argument :P. JavaScript is not code, it is script; script runs within another program. A poorly written program runs on it's own it requires proper writing because of this. A good program that accepts script will prevent it from breaking itself. Hence why if you check bugzilla, you'll see what are considered bugs relating to poorly written JavaScript causing Firefox to crash. This topic is pretty opinionated though, so I'll leave it at that! (The first comment was more of a joke since the browser leaks not jQuery) –  Jeff F. May 27 '11 at 14:08

If you aren't already doing so, you might try upgrading to the latest FireFox. They've worked hard to reduce those memory leaks.

share|improve this answer
    
I always upgraded and problem stayed. I prefer to live with Firefox 3.6.17 –  Boris_yo May 30 '11 at 13:54

In about:config, set browser.sessionstore.interval to a large number (it should be 10,000 or 15,000; set it to about 600,000).

Basically, this is the number of milliseconds between times that Firefox updates your "saved session". If you have many tabs open, or a long browsing history (or, as is often the case with me, both), this can be writing a ridiculous amount of data to the sessionstore.js file every 10 or 15 seconds, which can cause Flash videos to freeze briefly or even render your entire computer frozen every few minutes.

Setting this value to a large number has the disadvantage that if Firefox crashes, you lose your last few minutes of browsing history when you try to restore. That's a small price to pay in my opinion.

Your CPU spikes should become much less frequent.

share|improve this answer
    
I have Session Manager plugin installed. It also saves sessions allowing better management and customization. What if Firefox and this plugin both update sessions causing high CPU usage and crashes? Is there a way to disable Firefox's session update function and keep Session Manager? –  Boris_yo Mar 13 '12 at 12:07

It won't fix memory leakes per se. But enabling "Don't load tabs until selected" will at least not load the tabs until you click on them after a restart, which keeps memory way down.

I also found using CCleaner to clean the Firefox "Session" helped a bit. Back up all your open tabs first as it removes the session recovery information. Before running CCleaner my sessionstore.js file was about 800KB, but afterwards it's down to about 6KB.

More information about sessionstore can be found here http://helgeklein.com/blog/2010/12/solved-firefox-freezes-every-10-seconds-scrolling-is-jumpy/

Update uninstalling Flashblock fixed my high CPU issues with Firefox. Perhaps Flashblock and Adblock Plus or some other extension don't get along?

Update 2 life's too short to mess around with Firefox. I just exported my bookmarks, and uninstalled Firefox, then deleted all the Firefox folders on the machine, and then reinstalled Firefox from scratch, and restored the bookmarks. Now it runs faster than Google Chrome with a totally new install.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.