13

My version of Firefox has a runaway process/thread that makes it use 100% cpu on my MacBook Pro (OSX 10.7.4) after a few minutes. I've tried to use about:memory and about:addons-memory to try to figure out what is causing the issue, but it doesn't seem to be related to memory usage at all. Is there instead a way to see CPU usage by tab or add-on?

0

4 Answers 4

6

Actually, the about:memory tab does show memory allocation by tab; it's just a bit difficult to grok.

When you go to about:memory, you should see a list of memory allocations arranged hierarchically. The first top-level item in the list should be Explicit Allocations. Under that are several leaf nodes. The one you are looking for is window-objects. Under that, most of the nodes labeled "top" refer to tabs (if you load a web site, you'll see the address next to "top"). For example, I see:

├───29.63 MB (15.27%) -- window-objects
│   ├──12.64 MB (06.52%) ++ top(chrome://browser/content/browser.xul, id=3)
│   ├───6.84 MB (03.53%) ++ top(http://www.cnn.com/, id=31)
│   ├───4.55 MB (02.35%) ++ top(https://ftp.mozilla.org/, id=24)
│   ├───3.50 MB (01.80%) ++ (5 tiny)

The numbers in the front is the memory usage, also given as a percentage of Firefox's overall memory usage.

Add on memory usage is also shown, but not explicitly by add on. You'd have to search through the list to figure that out by finding all of the components belonging to an add on and adding up the memory allocations.

Note, I'm on the Beta channel (so currently using Firefox 22.0b2) but I believe that this works on older releases.

4
  • thanks, i didn't happen to notice any memory leaks though. it seems that memory tends to stay fairly constant. it's just that after a while, the cpu spikes and stays that way.
    – claire
    May 29, 2013 at 4:17
  • 12
    Question was specifically about CPU usage, not memory. Dec 25, 2013 at 5:03
  • @laggingreflex: Yes, I know. I was replying to the statement "but it doesn't seem to be related to memory usage at all." However, looking back on it, maybe claire actually meant "CPU" instead of "memory." Dec 30, 2013 at 14:55
  • With Firefox 38 (running on Linux), I had to click Measure under Show Memory Reports in order to generate and view the tree you describe. (If this is the same on all platforms, it could make the answer a bit more complete.) Jun 30, 2015 at 13:19
5

There are several reasons for high CPU usage in Firefox, detailed below.

1.Add-ons

The usual cause for CPU problems is a bad add-on. The first test one should do is start Firefox without add-ons.

From Troubleshoot Firefox issues using Safe Mode :

At the top of the Firefox window, click the Firefox button, go over to the Help menu and select Restart with Add-ons Disabled.... Firefox will start up with the Firefox Safe Mode dialog. Note: You can also start Firefox in Safe Mode by holding down the shift key while starting Firefox.

You now have two options:

Clicking the Start in Safe Mode button will temporarily disable your extensions and themes, turn off hardware acceleration and reset toolbar and button customizations. When you leave Safe Mode and start Firefox up normally, your extensions, themes, and settings will return to the state they were in before you entered Safe Mode.

If in Safe mode you have no CPU problems, then the problem is with one of your add-ons. You could use the menu Tools > Add-ons to selectively disable add-ons and restart Firefox until you find the bad one.

2.Flash

Flash is known for such problems. One of the usual ways of fixing it is to Disable Firefox's Hardware Acceleration by using the menu Tools > Options, Advanced tab, to uncheck Use Hardware Acceleration When Available.

The two add-ons Adblock Plus and NoScript are recommended to selectively block unnecessary elements, including Flash, on the page you are viewing.

3.JavaScript

The JavaScript in the website you are viewing in one of your tabs might be badly coded and wasting CPU by looping.

The best remedy is to use NoScript to avoid executing JavaScript from websites that you don't trust. This is also a security measure that anyone should use to avoid Cross-site scripting exploits.

4.Profiling

If it is highly unclear which website is causing the high CPU, one can use profiling in Firefox, although this is not a simple exercise.

Debuggers that also do profiling are :

If you are a developer and feeling like an adventure, and since you are on the Mac, you could use DTrace as explained in Performance/Optimizing JavaScript with DTrace, which is the tool that the Mozilla developers use.

3

@claire: There is currently no 'easy' way, to see what you want. If you go the way of harrymc, you will find some information about the source of the problem, but maybe not for sure.

If you want to go the 'hard' way, that will show you which is eating your CPU within firefox and/or it's plugins, you need to start debugging your firefox in your environment (sometimes it's not just firefox and or the plugin itself, but a corrupted lib they rely on). Here is a full explanation on hot to do it, if you have some idea about programming. XCode is free to be downloaded from apple:

https://developer.mozilla.org/en-US/docs/Debugging_on_Mac_OS_X

But you don't need to debug the full mozilla code, but you will find the point that is in correlation with the raising CPU usage. That can tell you exactly where the problem comes from (such bad looping etc.).

1
+50

If for some reason your Firefox is taking up and eating all your CPU usage, then you can try to limit the no. of processors and the priority that the CPU will give to that process to reduce the CPU usage.

For doing this, click (Ctrl+Alt+Del) to open Task Manager and then click process tab (the one that shows all the process with their extension (basically as you are on Windows all process should be ending with an .exe extension). Right click on it and select Select priority to set the priority (If it's set to higher than normal then put it to normal, otherwise if it's set to normal and you want to lower it more than select lower value than normal) and Set Affinity to limit the no. of processors that contribute to that process. Set the no. of processors you want to and then click ok to go back. Check to see if this works.

Remember this works only for multiprocessor computers (like dual-core, quad-core, etc.) and also that CPU usage is different from memory usage.

2
  • 1
    Sorry for my mistake I forgot to read that you were using firefox on MAC. I don't have much experience with MAC but if it contains any task manager like the windows one, this method works only for windows system.
    – Hunter
    Dec 25, 2013 at 6:30
  • 3
    This is a good advice but in no way comes even close to answering the actual question. Dec 25, 2013 at 9:16

Not the answer you're looking for? Browse other questions tagged .