Check CPU usage by tab or by add-on on firefox on mac [duplicate]
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?
Solution 1:
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.
Solution 2:
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 :
- The menu
Tools > Web developer > Profiler
- the Firebug add-on
- The JavaScript Deobfuscator add-on
- The Firefox built-in profiler (not for the faint of heart).
See also the Mozilla article Reporting a Performance Problem.
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.
Solution 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.).