As I sit here right now my laptop is uncomfortably hot and its fans are making a really loud high pitched whine. Something on my computer is spinning the CPU and it’s making me literally hot. I look at the processes and FireFox is taking between 40% and 80% of the CPU! I’m basically sitting idle too. Well, right now I’m typing this message in Firefox, but 5 minutes ago the computer was sitting unattended and it was still going nuts.
Ok, so Firefox is wigging. But why? I can’t find any way to do some introspection. I suspect it’s one or two errant pages sitting in a tight javascript or flash loop. But how can I find out which pages? I have 26 windows open and most windows have multiple tabs open each (one has 30 tabs). Each of them is open for a reason–some unfinished business I have at each page, so I can’t just close them randomly. Besides, that would admit defeat.
What I need is a plug-in that monitors all the javascript and plugins that are running and keeps track of how long each runs. Then I want a unix top-like view of all the open pages and how many resources each is consuming (how much memory, how much cpu time their javascript is taking, etc). Why doesn’t this already exist? Sadly I just don’t have time right now to write such a thing, considering how much I’d have to first learn about the internal workings of Mozilla threads (I assume they are all green threads, because something is running so much my typing has a significant delay every few seconds).
Please, please, please (let me get what I want) won’t somebody write something like this? How do you Mozilla developers work? Is there a Javascript profiler available already? I’ve searched the add-ons before but I can’t find anything like this.
All I know is my lap is getting hot and I can’t do anything about it because I need Firefox open right now and it’s beginning to really annoy me.
Easy – Microsoft and/or Opera hasn’t written one yet for them to copy.
As soon as someone else does it Mozilla will copy it.
Mozilla – no original ideas (and no memory leaks) for 5+ years!
While it does not give you a JavaScript top at this time, Firebug sure seems as the way towards a solution – http://www.getfirebug.com/
And if you have to actually tab through your pages to see what is happening, you could probably implement the feature thought the API or request it at their wiki.
To EasyAnswer: I am not able to discuss originality, but if you know of an extension comparable to Firebug for another browser (not talking of Firebug Lite), it could be really useful.
Best regards,
-fb
try firefox nightly builds.
@anonymcowardaboveme
Yes, yes FF 1 copied tabs from ie 7, I remember now.
Neadless to go into another browser war, but check your facts before being smart
run firefox on solaris and use dtrace
firefox should allow people to write in ruby instead of javascript.
i have written in ruby since 5 years by now and its a lot better than javascript will ever become.
Why? You know for sure it’s Flash that’s hogging CPU
Install noscript, and disable ALL scripting by default — only enable when needed for as long as needed.
Still, a “what’s running where” capability would be nice too — along with some fine-grained control over the JS interpreter.
Flashblock
And possibly NoScript but the cause is rarely Javascript
Firebug has a JS profiler you could use. So does the Venkman JS debugger.
You’re right, this would be a cool tool. There’s some students working on a “PluginWatcher” extension to monitor plugin activity.
ok, you have 26 windows open with up to 30 tabs, and youre surprised your laptop has a tough time with that? It’s probably addressing its virtual memory, swapping data like crazy
I agree, a process/memory monitor would be great. There have been many times that Firefox freezes up on me while using 95% to 100% of the CPU.
It’s your platform that sucks. I use Firefox on Linux and with htop I can easily monitor each Firefox process (read tabs) in a convenient tree view and kill them independently.
What’s really killing me in windows is the svchost process, now that’s stupid.
@EasyAnswer
It’s the other way around, Firefox leaks memory and get copied.
There’s no process viewer in Firefox because the one person in the world who thinks there should be one is too busy blogging about it to build it.
You can bookmark all tabs in a window and close it until, then the next window then the next, until you see your cpu get back to idle.
Then you know which one was it.
Then you can reopen the bookmarked tab groups in new windows.
You can do the same for each tab in the window that causes the problem to find out which tab was it.
Also, because javascript must run in single threaded mode and objects can reference DOM objects from other tabs/windows, all the javascript in the firefox process runs as a single thread, so they can’t really implement top easily.
EasyAnswer: I take offense of your remarks. Mozilla does NOT copy IE, only Opera (that’s the reason why Ff has become a great web navigator).
@EasyAnswer,
I normally don’t engage in flamebaits, but I’d like to give just one counter-example to your statement: Firebug. Recently, I read an announcement somewhere that IE8 will include a tool similar to Firebug, so that means that Microsoft did in fact “steal” an original and great idea that a Firefox user had. Not that I have a problem with that, this competition will only increase the quality of both products making it better for the users of both products.
Because the whole of Firefox is one giant Javascript loop?
@KL, EasyEasyAnswer:
I do run Flashblock, but I didn’t want to rule out some bit of flash I enabled running somewhere. I actually think it is way more likely that javascript is the culprit.
@baczek:
I’ve been running FF3 beta 3 and I notice that today beta 4 is out. The nightlies make me a bit nervous. We’ll see how beta 4 handles things (so far the betas have been much more memory conscious than FF2, but more prone to CPU spinning).
@Zeev:
That’s a good idea, but it seems a bit tedious. It may eventually come to that.
@mlh:
I don’t really have access to a Solaris machine. But I am running OS X to which dtrace was recently added. Does anyone know if OS X Firefox has dtrace hooks enabled?
@fuffuf:
I do expect it to behave nicely. When there’s no user input the only thing that should be happening is javascript timeouts and animated gif timeouts. Since I use adblock I generally don’t have any animated gifs sitting on pages. If a page has a timeout set and it’s doing a bunch of calculations constantly it’s really a badly designed page. I really think Firefox shouldn’t honor JS timeouts if the tab isn’t even visible.
According to Activity Monitor it is taking 1.1 GB of virtual memory but only 450MB of that is in physical memory. There is no active swap thrashing going on. About once a second something goes and allocates 20MB of RAM and then frees it. But I have enough free RAM that it is not going to swap.
@Robert O’Callahan:
That’s good news. If it doesn’t do what I want it sounds like it could at least be a good piece of code to adapt. Hope it comes out soon…
Any browser would choke on that many pages/windows open.
@Dan:
No! This sentiment seems to be shared by many people, but it’s just not true. Generally Firefox is perfectly fine with that many windows and tabs open. Which means generally pages are well behaved with regard to javascript.
But sometimes it does what I described above and I wish I had a way to track down which page is the one with the problem.
What you need to do is close about 21 of your windows and save yourself from getting an even weaker attention span.
Just wanted to add a good word for NoScript. It solves all sorts of problems before they even start.
firefox isn’t multithread you can’t have a process viewer because there is just one process.
@Sebastian:
It is multithreaded for all intents and purposes, just not with preemptive native OS/pthreads. It has green threads, like I said in the article.
As long as FireFox knows which javascript function comes from what page (and they have to because of the “window” global variable) then they can keep track of which page is running what code and present me with a list of pages and % of time spent running scripts in them.
Well, I am here because I am looking for the same thing. I haven’t found it, but I’ve found something that will let you file down the list of possibilities, a lot.
It’s a typical method for programmers and hardware techs: ‘Turn it off/unplug it. If it works without it, you’ve found your problem.’
“Adblock Plus’ for FireFox won’t give you the detailed readouts we’re fiending for, but it will allow you to switch off SPECIFIC items on page. You can turn off .js files that you think are unnecessary, like urchin.js for google analytics (if you don’t feel the need to be counted), or some stupid image to vote for a site as number 1 at Animegames.com or where ever.
It starts simply. You click “block” on all the repetitive flash ads for Warcraft and other crap. You’ve seen them a hundred times, slowing down your PC, wasting your resources. You’re never going to buy, primarily because they don’t just use a text ad.
Then, you get more advanced. CTRL+Shift+V opens the ‘blockable items’ pane, which you use to start cutting out little blinking animated gif files—How cute!—and image ads for wedding planning services that you don’t want your girlfriend to see (probably still hoping she’ll settle for a second hand dress and lots of glitter).
Finally, you end up admitting that you never had too much of a problem with any of them, in the first place. Right back to where we started: just plain interested in what the heck is going on!
A nice discussion with the point well made by the original poster. I too would very much like to see a Chrome-like tab monitor for Firefox