Closed Bug 720236 Opened 13 years ago Closed 13 years ago

An analysis of the memory consumption of 16 add-ons

Categories

(Firefox :: General, defect)

9 Branch
x86_64
Windows 7
defect
Not set
normal

Tracking

()

RESOLVED INCOMPLETE

People

(Reporter: samshahla, Unassigned)

Details

(Whiteboard: [MemShrink])

I 'm using FF 9 (stable) with 16 addons (Win7, 64 bit, 6GB of memory).

My extensions (as copied from "about:support"):
      
Adblock Plus2.0.3
Adblock Plus Pop-up Addon0.3
DownloadHelper4.9.8
Element Hiding Helper for Adblock Plus1.1.4
FindBar Tweak0.5.5
FlashGot1.3.7
GoogleEnhancer1.87
Image Zoom0.4.6
LastPass1.80.0
MinimizeToTray revived (MinTrayR)1.0
NoScript2.2.7
Pixlr Grabber2.1.1
Readability2.1
Tab Mix Plus0.3.8.7
TinEye Reverse Image Search1.1
United States English Spellchecker5.0.1


Though FF's memory usage has significantly gone down and though it seems that you focus on zombie compartments created by addons rather the memory used by them, I have to tell that FF extensions actually consume lots of memory.
The picture is the same with FF nightly (v.12). I disabled all my 16 addons and I feld a BIG difference. FF runs very smooth with all addons disabled. I have cleaned up my FF (CTRL+SHIFT+Del) and restarted it. The total explicit memory used by FF with addons disabled was 30.60MB (see below).


Main Process

Explicit Allocations
30.60 MB (100.0%) -- explicit
├──13.09 MB (42.78%) -- js
│  ├───8.17 MB (26.71%) -- compartment([System Principal], 0x7661000)
│  │   ├──4.33 MB (14.14%) -- gc-heap
│  │   │  ├──1.83 MB (05.97%) -- objects
│  │   │  ├──1.30 MB (04.25%) -- shapes
│  │   │  ├──0.58 MB (01.91%) -- arena-unused
│  │   │  ├──0.53 MB (01.73%) -- scripts
│  │   │  └──0.08 MB (00.28%) -- (5 omitted)
│  │   ├──1.05 MB (03.44%) -- script-data
│  │   ├──0.63 MB (02.04%) -- mjit-code
│  │   │  ├──0.55 MB (01.80%) -- method
│  │   │  └──0.07 MB (00.24%) -- (2 omitted)
│  │   ├──0.62 MB (02.03%) -- analysis-temporary
│  │   ├──0.40 MB (01.32%) -- object-slots
│  │   ├──0.40 MB (01.29%) -- (5 omitted)
│  │   ├──0.32 MB (01.04%) -- property-tables
│  │   ├──0.22 MB (00.71%) -- tjit-data
│  │   │  └──0.22 MB (00.71%) -- (3 omitted)
│  │   └──0.21 MB (00.70%) -- mjit-data
│  ├───3.00 MB (09.81%) -- gc-heap-chunk-dirty-unused
│  ├───0.99 MB (03.24%) -- compartment(atoms)
│  │   ├──0.57 MB (01.85%) -- string-chars
│  │   ├──0.43 MB (01.39%) -- gc-heap
│  │   │  ├──0.42 MB (01.36%) -- strings
│  │   │  └──0.01 MB (00.03%) -- (3 omitted)
│  │   └──0.00 MB (00.00%) -- (1 omitted)
│  ├───0.41 MB (01.35%) -- runtime
│  │   ├──0.25 MB (00.82%) -- atoms-table
│  │   └──0.16 MB (00.54%) -- runtime-object
│  ├───0.26 MB (00.85%) -- (5 omitted)
│  └───0.25 MB (00.82%) -- stack
├──12.58 MB (41.10%) -- heap-unclassified
├───2.90 MB (09.49%) -- storage
│   └──2.90 MB (09.49%) -- sqlite
│      ├──1.59 MB (05.19%) -- places.sqlite
│      │  ├──1.51 MB (04.93%) -- cache-used [4]
│      │  └──0.08 MB (00.26%) -- (2 omitted)
│      ├──0.53 MB (01.74%) -- other
│      ├──0.42 MB (01.37%) -- (4 omitted)
│      ├──0.20 MB (00.65%) -- content-prefs.sqlite
│      │  ├──0.19 MB (00.62%) -- cache-used
│      │  └──0.01 MB (00.03%) -- (2 omitted)
│      └──0.16 MB (00.53%) -- cookies.sqlite
│         ├──0.16 MB (00.51%) -- cache-used
│         └──0.01 MB (00.02%) -- (2 omitted)
├───0.89 MB (02.90%) -- xpti-working-set
├───0.81 MB (02.65%) -- layout
│   ├──0.43 MB (01.40%) -- shell(chrome://browser/content/browser.xul)
│   │  ├──0.30 MB (00.99%) -- arenas
│   │  └──0.13 MB (00.41%) -- (1 omitted)
│   ├──0.23 MB (00.74%) -- shell(about:memory)
│   │  └──0.23 MB (00.74%) -- (2 omitted)
│   └──0.16 MB (00.51%) -- (2 omitted)
├───0.16 MB (00.54%) -- images
│   ├──0.16 MB (00.51%) -- chrome
│   │  ├──0.16 MB (00.51%) -- used
│   │  │  ├──0.16 MB (00.51%) -- uncompressed-heap
│   │  │  └──0.00 MB (00.00%) -- (2 omitted)
│   │  └──0.00 MB (00.00%) -- (1 omitted)
│   └──0.01 MB (00.03%) -- (1 omitted)
├───0.16 MB (00.51%) -- dom
└───0.01 MB (00.03%) -- (2 omitted)

Other Measurements
  0.09 MB -- gfx-d2d-surfacecache
 11.62 MB -- gfx-d2d-surfacevram
  0.17 MB -- gfx-surface-image
  0.00 MB -- gfx-surface-win32
 21.16 MB -- heap-allocated
 23.64 MB -- heap-committed
  1.00 MB -- heap-dirty
  6.83 MB -- heap-unallocated
        2 -- js-compartments-system
        3 -- js-compartments-user
  8.00 MB -- js-gc-heap
  0.65 MB -- js-gc-heap-arena-unused
  0.00 MB -- js-gc-heap-chunk-clean-unused
  3.00 MB -- js-gc-heap-chunk-dirty-unused
   45.64% -- js-gc-heap-unused-fraction
 84.98 MB -- private
133.23 MB -- resident
354.64 MB -- vsize



Then I enabled all my 16 addons and FF's explicit memory rose to 100.90MBs (see below).



Main Process

Explicit Allocations
100.90 MB (100.0%) -- explicit
├───62.84 MB (62.28%) -- js
│   ├──44.60 MB (44.20%) -- compartment([System Principal], 0x7561000)
│   │  ├──21.30 MB (21.11%) -- gc-heap
│   │  │  ├───9.24 MB (09.16%) -- objects
│   │  │  ├───4.52 MB (04.48%) -- arena-unused
│   │  │  ├───4.51 MB (04.47%) -- shapes
│   │  │  ├───1.44 MB (01.42%) -- strings
│   │  │  ├───1.36 MB (01.34%) -- scripts
│   │  │  └───0.23 MB (00.23%) -- (4 omitted)
│   │  ├───5.73 MB (05.68%) -- mjit-code
│   │  │   ├──5.13 MB (05.08%) -- method
│   │  │   ├──0.55 MB (00.54%) -- regexp
│   │  │   └──0.05 MB (00.05%) -- (1 omitted)
│   │  ├───4.54 MB (04.50%) -- string-chars
│   │  ├───3.72 MB (03.69%) -- script-data
│   │  ├───2.72 MB (02.69%) -- mjit-data
│   │  ├───2.40 MB (02.37%) -- object-slots
│   │  ├───2.08 MB (02.06%) -- analysis-temporary
│   │  ├───1.36 MB (01.34%) -- property-tables
│   │  └───0.75 MB (00.74%) -- (4 omitted)
│   ├──11.34 MB (11.24%) -- gc-heap-chunk-dirty-unused
│   ├───4.63 MB (04.59%) -- compartment(atoms)
│   │   ├──3.16 MB (03.13%) -- string-chars
│   │   ├──1.47 MB (01.46%) -- gc-heap
│   │   │  ├──1.45 MB (01.44%) -- strings
│   │   │  └──0.02 MB (00.02%) -- (3 omitted)
│   │   └──0.00 MB (00.00%) -- (1 omitted)
│   ├───1.16 MB (01.15%) -- runtime
│   │   ├──1.00 MB (00.99%) -- atoms-table
│   │   └──0.16 MB (00.16%) -- (1 omitted)
│   ├───0.57 MB (00.56%) -- (6 omitted)
│   └───0.54 MB (00.53%) -- gc-heap-chunk-admin
├───27.64 MB (27.39%) -- heap-unclassified
├────5.63 MB (05.58%) -- storage
│    └──5.63 MB (05.58%) -- sqlite
│       ├──2.57 MB (02.55%) -- places.sqlite
│       │  ├──2.42 MB (02.40%) -- cache-used [4]
│       │  └──0.15 MB (00.15%) -- (2 omitted)
│       ├──1.65 MB (01.64%) -- (10 omitted)
│       ├──0.87 MB (00.87%) -- other
│       └──0.54 MB (00.53%) -- extensions.sqlite
│          └──0.54 MB (00.53%) -- (3 omitted)
├────1.94 MB (01.92%) -- dom
│    ├──1.94 MB (01.92%) -- other
│    └──0.00 MB (00.00%) -- (1 omitted)
├────1.48 MB (01.47%) -- layout
│    ├──0.90 MB (00.89%) -- (6 omitted)
│    └──0.58 MB (00.57%) -- shell(chrome://browser/content/browser.xul)
│       └──0.58 MB (00.57%) -- (2 omitted)
├────0.92 MB (00.91%) -- xpti-working-set
└────0.46 MB (00.46%) -- (4 omitted)

Other Measurements
  0.48 MB -- canvas-2d-pixel-bytes
  0.22 MB -- gfx-d2d-surfacecache
 12.31 MB -- gfx-d2d-surfacevram
  0.41 MB -- gfx-surface-image
  0.00 MB -- gfx-surface-win32
 58.74 MB -- heap-allocated
 67.33 MB -- heap-committed
  2.93 MB -- heap-dirty
 43.25 MB -- heap-unallocated
        2 -- js-compartments-system
        5 -- js-compartments-user
 35.00 MB -- js-gc-heap
  4.71 MB -- js-gc-heap-arena-unused
  0.00 MB -- js-gc-heap-chunk-clean-unused
 11.34 MB -- js-gc-heap-chunk-dirty-unused
   45.84% -- js-gc-heap-unused-fraction
188.59 MB -- private
246.55 MB -- resident
530.26 MB -- vsize



After doing some math (100.9-30.6), you can see that 16 addons consume around (~) 70.3MBs! That's 229.7% increase in explicit memory! If you divide this number into 16 (the number of addons), you'll see that each addon consumes around 4.93MBs of memory. Of course, it's a very rouch and imprecise calculation particularly if you take into account that some addons that I have (like TinEye Reverse Image Search or Readability) shall not be using any memory unless they are called to perform some function (which is only redirection to external webpage in the case of these two addons).

The next step I'm going to do is to disable again all 16 addons and then to start enabling few addons that I don't suspect to be causing a significant memory increase. The reason why I'm doing so is because all this calculation is very imprecise and it's nearly impossible to identify how much 1 addon uses since the explicit memory varies every time you refresh about:memory.



- Enabled TinEye Reverse Image search + Readability + Pixlr Grabber + US English Spellchecker. Explicit memory has increased very slightly from ~ 30 to 32MBs (~0.5MB per each addon)
- Next I enable Minimize to Tray revived + FindBar Tweak + Image Zoom + GoogleEnhancer. Explicit memory has increased from ~ 32 to 34MBs (~ 0.5MB per each addon)
- Next I enable Adblock Plus + Adblock Plus Pop-up Addon + Element Hiding Helper for Adblock Plus + NoScript. Explicit memory has increased from ~ 34 to 70MBs (~9MB per each addon). To find the leaky addon I will start disabling them one by one.
	- Disabled Element Hiding Helper. Explicit memory dropped to ~ 66-67MBs
	- Disabled Adblock Plus Pop-up Addon.  Explicit memory dropped to ~ 45MBs
	- Disabled Adblock Plus. Explicit memory dropped to ~ 41-42MBs
	- Disabled NoScript. Explicity memory dropped to ~ 34MBs
- Next I'm re-enabling all 4 disabled addons and also the remaining 4 addons, namely: DownloadHelper + FlashGot + LastPass + TabMix Plus. Explicit memory increased to ~ 100MBs.
	- Disabled TabMix Plus. Explicit memory dropped to ~95MBs
	- Disabled LastPass. Explicit memory dropped to ~ 75MBs
	- Disabled FlashGot. Explicit memory dropped to ~ 73MBs
	- Disabled DownloadHelper. Explicit memory dropped to ~ 70MBs.


As a result I get these rough numbers per each addon that I have:


Adblock Plus2.0.3				~ 3-4MBs
Adblock Plus Pop-up Addon0.3		~ 21MBs
DownloadHelper4.9.8			~ 3MBs
Element Hiding Helper for Adblock Plus1.1.4	~ 3-4MBs
FindBar Tweak0.5.5				~ 0.5MB
FlashGot1.3.7				~ 2MBs
GoogleEnhancer1.87			~ 0.5MB
Image Zoom0.4.6				~ 0.5MB
LastPass1.80.0				~ 20MBs
MinimizeToTray revived (MinTrayR)1.0		~ 0.5MB
NoScript2.2.7				~ 7-8MBs
Pixlr Grabber2.1.1				~ 0.5MB
Readability2.1				~ 0.5MB
Tab Mix Plus0.3.8.7				~ 5MBs
TinEye Reverse Image Search1.1		~ 0.5MB
United States English Spellchecker5.0.1		~ 0.5MB


I don't know if this info. could be useful in any way, but I hope that it gives you a picture of how much memory increases with 16 and each addon. Maybe it could be a good idea to think of measuring the memory used by addons in about:memory, no matter how difficult it might be to implement it.


R.
Whiteboard: [MemShrink]
Summary: Extensions using lots of memory → An analysis of the memory consumption of 16 add-ons
Thanks for the detailed analysis!  Very interesting.

Add-ons vary considerably in their impact, as you found.  Using more memory doesn't necessarily indicate a problem.  And generally it's memory leaks that cause memory consumption to grow over time that are a bigger problem than memory usage at start-up.  

However, I've noted in bug 674535 and bug 720929 that LastPass and Adblock Plus Pop-up Addon seem to have an excessive effect on start-up memory consumption.

As for this bug report, I don't think there is any further actions to be taken, so I'm going to close it.  (Rust, please tell us if you disagree!)  I will mention this analysis in my MemShrink report for this week, because I think it will be interesting to many people.  Thanks again!
Status: UNCONFIRMED → RESOLVED
Closed: 13 years ago
Resolution: --- → INCOMPLETE
> I will mention this analysis in my MemShrink report for this week, because I
> think it will be interesting to many people.

http://blog.mozilla.com/nnethercote/2012/01/25/memshrink-progress-week-32/
You need to log in before you can comment on or make changes to this bug.