Closed Bug 676872 Opened 9 years ago Closed 8 years ago

High JS memory usage with many add-ons enabled

Categories

(Firefox :: General, defect)

8 Branch
x86_64
Linux
defect
Not set

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: rolandixor, Unassigned)

Details

(Whiteboard: [MemShrink:P3][closeme 2012-12-01])

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:8.0a1) Gecko/20110804 Firefox/8.0a1
Build ID: 20110804141158

Steps to reproduce:

Open any number of tabs, with addons enabled. 


Actual results:

Firefox eats RAM for breakfast, Lunch, Dinner, and sometimes for snacks in between.
Uses much less memory in safe mode, but still way too much.

In safe mode, it uses around 43.5 MB, but in normal browsing with Addons enabled (plugins disabled) it is using close to 400MB (with just 4 tabs!), and jumps to 1.5GB or so when using several tabs.

It seems from About:memory that JS is the culprit. It is using 53MB per tab at times. It is a bit difficult to track if an addon is responsible, but I am working on tracking this down.


Expected results:

Firefox should not be using this much memory.
What addons are you using? Read http://blog.mozilla.com/nnethercote/2011/08/03/memshrink-progress-week-7/ for some problematic addons. Also, what are the websites you are visiting, what versions of plugins, etc?
See the extension list here: http://pastebin.com/LbyMzgzA
P.S. I don't need to visit any site for it to happen, but for example, going to google.com, or facebook.com causes the problem.
that is an awful lot of extensions, narrowing this down will be a bit tough.
can you post everything from about:memory in both safe mode and in normal mode into attachments on this bug? thanks
43.5MB is entirely normal at start-up in safe mode.  (I assume this is the "explicit" figure from about:memory?)  And 53MB per tab (I assume you mean "per compartment"?) isn't necessarily unusual, it depends on how complex the JS in the compartment is.

You say "JS is the culprit", but really it's very likely that "the JS usage of one or more add-ons" is the culprit.  Unfortunately add-on memory usage isn't distinguished in about:memory (not for lack of desire, it's just really difficult to do).

Roland, probably the only way to make progress here is to selectively disable add-ons to work out which one (or ones) are the cause.
Summary: JS is eating RAM in Firefox on Linux. → High JS memory usage with many add-ons enabled
Whiteboard: [MemShrink]
I've begun trying to narrow down which extension causes the problem, but so far, it seems as if it is a matter of a combined problem. P.S. isn't 53 MB per "container" quite a lot?
Roland it depends on the container. The memory used by the container depends more on the content of the container than from Firefox.
For example you could create a really big array with JavaScript, or many other things. And the memory occupied would be more or less the same for every browser (at least if there isn't any memory leak).
A web page looks like a document but it can contain scripts (code) that could be doing just about anything.  So whether the memory usage is unreasonable depends entirely on what scripts the page is running.
Whiteboard: [MemShrink] → [MemShrink:P3]
I've been doing some more investigation. So far, I cannot seem to find a culprit among the addons (at least an individual one), and I have also removed a few along the way.

Memory usage is going down slightly, but it is still ridiculously high. At least in the latest nightlies it is gone down from 400+ to 380+ or so for the same number of tabs.

I will keep tracking the issue though and see how things progress :).
Thanks for your efforts, Roland!  What memory metric are you measuring?

Here's the original add-ons list from comment 2, I'm nervous that the pastebin will disappear at some point:

Enabled add-ons
---------------
Adblock Plus 1.3.9
Add-on Compatibility Reporter 0.8.7
Awesome screenshot: Capture and Annotate 2.3.1
Console² 0.8
Dir Up Lite 0.0.8.9m
Discrete Tab Badge 1.4
Element Hiding Helper for Adblock Plus 1.1.1
F1 by Mozilla Labs 0.8.3
Feed Sidebar 5.1.2
FirefoxNotify 1.5.4
FireStorage 1.0.2
Flashblock 1.5.15.1
FlashGot 1.3.0.4
Greasemonkey 0.9.7
HTML5 Notifications 0.7.2
Mozilla Labs: Lab Kit 3
Mozilla Labs: Prospector - Instant Preview 4
Mozilla Labs: Prospector - Snaporama 1
Mozilla Labs: Prospector - Speak Words 9
Mozilla Labs: Prospector - Tab Focus 1
Multiple Tab Handler 0.6.2011051101
Nightly Tester Tools 3.1.5.1
No XPI Install Delay 1.0
Personal Menu 5.0.5
PrivacyChoice TrackerBlock 2.0.1
Restart Jetpack 0.1.1
RSS Icon 1.0.6
Saved Password Editor 2.0.6
Save-To-Read 0.3.1.2
Session Manager 0.7.5
Start Google Plus 1.3.8
Stylish 1.2
TabGroups Menu 0.5.0.1
Tab Mix Plus 0.3.8.6
Translate This!  1.6.1
Turn Off the Lights 2.0.0.7
Ubuntu Firefox Modifications 0.9.1
UnityFox 0.1.5
VideoSurf Videos at a Glance 0.79
Web Developer 1.1.9
YesScript 1.9

disabled add-ons
----------------
Global Menu Bar integration 1.8
Print Edit 5.1


41 enabled add-ons!  That's a lot :)
NJN 41 extensions is not a lot and I can confirm that the biggest MemShrink efforts (fixing GC and so on) work with several extensions running, including many on this list. I am running Aurora and 33 extensions and everything is fine. I'd have 41 if enough Add-Ons updated fast enough to work with Aurora but instead I have 7 disabled because they do not.

Roland what specific version of (I presume) Ubuntu are you using? 

I've created an Add-On Collection with 35 of these Add-Ons:

https://addons.mozilla.org/en-US/firefox/collections/addonmsd/bug/?sort=name

This could help anyone who wants to investigate this bug (myself included). 

1) Install this:

https://addons.mozilla.org/en-US/firefox/addon/add-on-collector/

2) Visit the collection link above again
3) Click "Follow this collection"
4) Load Add-Ons in Firefox
5) Switch to Collections tab
6) At the bottom of the left column, click the "Reload All" icon and the bug collection should show up in the column above
7) Gradually install all the extensions listed on the right
8) Test away!

Add-Ons not on the list did not show up when I searched for them. These do not seem to be sourced from AMO. Here's my best guess links to the rest:

http://code.google.com/p/ff-html5notifications/
http://packages.ubuntu.com/hardy/ubufox
http://packages.ubuntu.com/search?keywords=firefox-notify

Just on first observation, there's two extensions there that *may* perform duplicate actions (if not conflict) and they are Tab Mix Plus (TMP) and Session Manager. TMP has the ability to manage sessions by itself but last time I installed TMP it prompted the user to allow Firefox's native session support (which only existed after TMP had a session manager function for a long time) instead of the built-in TMP support.

I use a lot of extensions (though on Windows XP) and I use TMP however I let Firefox's native session management take care of session handling. I do not have Session Manager installed.
Ooops. Actually I found 38 listed in AMO, rather than my above mentioned 35. 38 plus the three other links accounts for all the enabled Add-Ons.
41 is a lot of extensions.  See the 2nd graph from http://blog.mozilla.com/addons/2011/06/21/firefox-4-add-on-users/.  It's hard to say exactly, but users with 41 or more extensions are clearly a miniscule proportion of users -- the graphs doesn't even go past 25 because the number of users with that many is so small.

Now, I'm not saying there's anything wrong with using 41 extensions.  But the more extensions you use, the higher the chance that something will go wrong.
BTW thanks for putting together the add-on collection, that's very helpful!
(In reply to Nicholas Nethercote [:njn] (on vacation Sep 12--Oct 17) from comment #14)
> 41 is a lot of extensions.  See the 2nd graph from
> http://blog.mozilla.com/addons/2011/06/21/firefox-4-add-on-users/.  

Nuts, as soon as I posted that I thought there was probably a metric around somewhere that I'd missed! How dare you come back at me with cold hard facts, LOL!

> Now, I'm not saying there's anything wrong with using 41 extensions.  But
> the more extensions you use, the higher the chance that something will go
> wrong.

Well therein lies a fabulous advertising slogan for the superb quality of Firefox's Add-On architecture. How many times have I been told a design decision I disagree with or a missing feature is not a big deal, just tweak about:config or fix it with an extension? All of sudden too many extensions is problematic? Perhaps there should be a rule that all major changes to an otherwise settled interface are accompanied by an about:config opt-out pref? Whoops I better stop before I get nagged at for being off-topic.
(In reply to Nicholas Nethercote [:njn] (on vacation Sep 12--Oct 17) from comment #15)
> BTW thanks for putting together the add-on collection, that's very helpful!

Phew, I did something right other than putting foot in my big mouth :) I'm happy to do Add-On conflict detective work as my limited Mozilla code knowledge means I can't help MemShrink (the best Firefox initiative ever IMHO) another way. Hence my bugzilla account name :) Which Ubuntu are you running Roland? I'm on XP so can't debug the Collection until I know.

Any other bugs I can create Collections for? I've seen the MemShrink unconfirmed list but could use help sifting through it.
(In reply to Roland Taylor from comment #10)
> I've been doing some more investigation. So far, I cannot seem to find a
> culprit among the addons (at least an individual one), and I have also
> removed a few along the way.
> 
> Memory usage is going down slightly, but it is still ridiculously high. At
> least in the latest nightlies it is gone down from 400+ to 380+ or so for
> the same number of tabs.
> 
> I will keep tracking the issue though and see how things progress :).

(In reply to Nicholas Nethercote [:njn] from comment #11)
> Thanks for your efforts, Roland!  
> [Roland,] What memory metric are you measuring?

based on current version would be good :)
Flags: needinfo?(rolandixor)
Keywords: testcase-wanted
Whiteboard: [MemShrink:P3] → [MemShrink:P3][closeme 2012-12-01]
Closing due to lack of feedback from the reporter.  Also, there's a good chance that the anti-add-on fix in Firefox 15 helped with this case.
Status: UNCONFIRMED → RESOLVED
Closed: 8 years ago
Resolution: --- → INCOMPLETE
Seems to be better for me now.
Flags: needinfo?(rolandixor)
Resolution: INCOMPLETE → WORKSFORME
You need to log in before you can comment on or make changes to this bug.