MemShrink progress, week 71–72

B2G

Justin Lebar led the B2G charge this fortnight, doing the following.

Thinker Li identified that we were using overly large (128 KiB) arena chunks for type inference data in the JS engine.  Reducing them to 32 KiB saved over 3 MiB of memory on B2G.

Fabrice Desré disabled the add-on manager services, saving about 1 MiB.

These changes have all been backported to Aurora, because that’s the current home of the code that will be used for the V1 release of B2G.

Social API

Jared Wein modified the social sidebar so that it unloads itself 10 seconds after it’s been hidden.  This is good because lots of people thought that closing the sidebar was equivalent to disabling the social functionality, and with this change it now effectively is.

Felipe Gomes fixed a major problem which caused the social API to create and leak many unnecessary ports.

Gecko & SpiderMonkey

Benoit Jacob fixed a leak relating to WebGL and cycle collection.  This fixed 10 seconds pauses that occurred after running the RO.ME demo, and also fixed leaks seen in the WebGL version of Nokia Maps.

Kyle Huey fixed a bug that was causing storage code to leak one thread per connection.  This doesn’t affect most Firefox users much, because most connections live for the full lifetime of the process.  However, it could affect some add-ons, and it helped avoid some frequent OOM oranges in some of our tests.

Benjamin Peterson reduced the amount of memory used to compress JavaScript source code.

Add-ons

Zig fixed a zombie compartment in the Visited add-on.

Bug Counts

Here are the current bug counts.

  • P1: 18 (-4/+3)
  • P2: 113 (-2/+14)
  • P3: 97 (-1/+7)
  • Unprioritized: 2 (-13/+2)

Note:  in all my previous MemShrink reports, I mentioned bug fixes as soon as they landed on mozilla-inbound.  As of this week, I’m changing things so that I (mostly) only mention bug fixes that have landed on mozilla-central and thus been marked as RESOLVED.  This will make my life easier (tracking RESOLVED bugs is easy with Bugzilla search), and it will also mean that the changes in bug counts better match the descriptions of bug fixes.  But it means that some bug fixes will be reported two weeks later than they previously would.

20 Responses to MemShrink progress, week 71–72

  1. Raises hope that someday I will use close button in FF to close instead kill it from Activity Monitor.

  2. Hi Nick,

    Sounds like a great week for Memshrink. All this work has mended Firefox’s reputation in the broader community as evidenced by the responses in the Mozilla AUA on Reddit and in multiple HN threads. Kudos to the entire team.

    I had a question about the Social Sidebar bug you referenced in your post. What will the behavior be when a user is in Private Browsing mode? Apart from the reloading of Social content, will any interactions with the Social sidebar be persisted?

    Thanks,
    Manoj

  3. Dear Sirs, probably the wrong place to ask, but I am wondering how come that my FF under XP SP3 is using a 560 MB disk cache, yet when I close and restart, all tabs must be reloaded individually from the web only, instead of using the cached files?

    • Nicholas Nethercote

      Are you sure they’re being reloaded from the web? In my experience, they load from the cache, i.e. I have to reload to see the latest version of each page.

    • Mine all load from cache.
      I’ve tested it by putting Firefox in offline mode & loading unloaded tabs.
      (FYI file > Work Offline)
      There are some pages that will expire themselves in which case Firefox should give you an expiration message.

  4. Hi NN,

    I had my browser open (16.0.1) for two weeks with some fairly heavy browsing and experienced quite a lot of memory used: 631.56 MB with only about:memory open!

    Please let me know you think.

    My extensions are:
    -AdBlock Plus
    -Ghostery
    -IE Tab 2
    -NoScript
    -pdf.js

    My about:memory

    631.56 MB (100.0%) — explicit
    ├──221.30 MB (35.04%) — window-objects
    │ ├──202.57 MB (32.08%) — top(none)/detached/window([system])
    │ │ ├──202.54 MB (32.07%) — js
    │ │ │ ├──190.98 MB (30.24%) — compartment([System Principal], about:blank)
    │ │ │ │ ├──110.36 MB (17.47%) — gc-heap
    │ │ │ │ │ ├───44.34 MB (07.02%) ── unused-gc-things [35]
    │ │ │ │ │ ├───25.83 MB (04.09%) — objects
    │ │ │ │ │ │ ├──18.41 MB (02.91%) ── non-function [35]
    │ │ │ │ │ │ └───7.42 MB (01.17%) ── function [35]
    │ │ │ │ │ ├───18.54 MB (02.94%) — shapes
    │ │ │ │ │ │ ├───8.29 MB (01.31%) ── tree [35]
    │ │ │ │ │ │ ├───8.27 MB (01.31%) ── dict [35]
    │ │ │ │ │ │ └───1.98 MB (00.31%) ── base [35]
    │ │ │ │ │ ├───12.08 MB (01.91%) ── strings [33]
    │ │ │ │ │ ├────8.85 MB (01.40%) ── scripts [35]
    │ │ │ │ │ └────0.72 MB (00.11%) ++ (2 tiny)
    │ │ │ │ ├───34.83 MB (05.52%) ── script-data [35]
    │ │ │ │ ├───16.19 MB (02.56%) — objects
    │ │ │ │ │ ├──13.18 MB (02.09%) ── slots [35]
    │ │ │ │ │ └───3.00 MB (00.48%) ── elements [33]
    │ │ │ │ ├────9.88 MB (01.56%) ++ shapes-extra
    │ │ │ │ ├────9.80 MB (01.55%) ── cross-compartment-wrappers [33]
    │ │ │ │ ├────9.53 MB (01.51%) ── string-chars [33]
    │ │ │ │ └────0.39 MB (00.06%) ++ (2 tiny)
    │ │ │ ├───10.41 MB (01.65%) ++ compartment([System Principal], chrome://browser/content/browser.xul)
    │ │ │ └────1.15 MB (00.18%) ++ (2 tiny)
    │ │ └────0.04 MB (00.01%) ── dom/other [77]
    │ ├───16.24 MB (02.57%) — top(chrome://browser/content/browser.xul, id=3)/active
    │ │ ├──15.26 MB (02.42%) — window(chrome://browser/content/browser.xul)
    │ │ │ ├──12.83 MB (02.03%) ++ js/compartment([System Principal], about:blank)
    │ │ │ └───2.43 MB (00.39%) ++ (4 tiny)
    │ │ └───0.98 MB (00.15%) ++ (2 tiny)
    │ └────2.49 MB (00.39%) ++ (3 tiny)
    ├──206.20 MB (32.65%) ── heap-unclassified
    ├──174.15 MB (27.57%) — js-non-window
    │ ├──123.63 MB (19.58%) — compartments
    │ │ ├──105.23 MB (16.66%) — non-window-global
    │ │ │ ├───51.78 MB (08.20%) — compartment([System Principal], file:///C:/Users/TEMP.HGSI.016/AppData/Roaming/Mozilla/Firefox/Profiles/fab9uyrg.default/extensions/firefox@ghostery.com/components/ghostery-content-policy.js)
    │ │ │ │ ├──22.26 MB (03.52%) ── string-chars
    │ │ │ │ ├──20.43 MB (03.24%) — gc-heap
    │ │ │ │ │ ├──12.07 MB (01.91%) ── strings
    │ │ │ │ │ ├───6.56 MB (01.04%) — objects
    │ │ │ │ │ │ ├──6.54 MB (01.04%) ── non-function
    │ │ │ │ │ │ └──0.02 MB (00.00%) ── function
    │ │ │ │ │ └───1.80 MB (00.28%) ++ (5 tiny)
    │ │ │ │ ├───8.86 MB (01.40%) — objects
    │ │ │ │ │ ├──8.82 MB (01.40%) ── slots
    │ │ │ │ │ └──0.04 MB (00.01%) ── elements
    │ │ │ │ └───0.23 MB (00.04%) ++ (4 tiny)
    │ │ │ ├───34.30 MB (05.43%) ++ (214 tiny)
    │ │ │ └───19.15 MB (03.03%) — compartment([System Principal], jar:file:///C:/Users/TEMP.HGSI.016/AppData/Roaming/Mozilla/Firefox/Profiles/fab9uyrg.default/extensions/%7Bd10d0bf8-f5b5-c8b4-a8b2-2b9879e08c5d%7D.xpi!/bootstrap.js (from: resource:///modules/XPIProvider.jsm:3595))
    │ │ │ ├──13.92 MB (02.20%) — gc-heap
    │ │ │ │ ├───7.51 MB (01.19%) ++ (6 tiny)
    │ │ │ │ └───6.41 MB (01.02%) ── unused-gc-things
    │ │ │ └───5.22 MB (00.83%) ++ (7 tiny)
    │ │ └───18.41 MB (02.91%) — no-global/compartment(atoms)
    │ │ ├──12.78 MB (02.02%) ── string-chars
    │ │ └───5.63 MB (00.89%) ++ (2 tiny)
    │ ├───44.98 MB (07.12%) — gc-heap
    │ │ ├──41.35 MB (06.55%) ── decommitted-arenas
    │ │ └───3.63 MB (00.57%) ++ (3 tiny)
    │ └────5.54 MB (00.88%) ++ runtime
    ├───15.56 MB (02.46%) ++ (12 tiny)
    └───14.34 MB (02.27%) — storage
    ├──12.85 MB (02.03%) — sqlite
    │ ├───6.88 MB (01.09%) ++ places.sqlite
    │ └───5.96 MB (00.94%) ++ (13 tiny)
    └───1.50 MB (00.24%) ── prefixset/all

    Other Measurements
    347 (100.0%) — js-compartments
    ├──341 (98.27%) ── system
    └────6 (01.73%) ── user

    392.41 MB (100.0%) — js-main-runtime
    ├──341.90 MB (87.13%) — compartments
    │ ├──187.02 MB (47.66%) — gc-heap
    │ │ ├───73.49 MB (18.73%) ── unused-gc-things
    │ │ ├───43.14 MB (10.99%) — objects
    │ │ │ ├──32.79 MB (08.36%) ── non-function
    │ │ │ └──10.35 MB (02.64%) ── function
    │ │ ├───31.21 MB (07.95%) ── strings
    │ │ ├───26.56 MB (06.77%) — shapes
    │ │ │ ├──12.20 MB (03.11%) ── dict
    │ │ │ ├──11.31 MB (02.88%) ── tree
    │ │ │ └───3.04 MB (00.77%) ── base
    │ │ ├───11.32 MB (02.89%) ── scripts
    │ │ └────1.30 MB (00.33%) ++ (3 tiny)
    │ ├───48.31 MB (12.31%) ── string-chars
    │ ├───44.24 MB (11.27%) ── script-data
    │ ├───30.66 MB (07.81%) — objects
    │ │ ├──26.68 MB (06.80%) ── slots
    │ │ └───3.98 MB (01.01%) ++ (2 tiny)
    │ ├───14.00 MB (03.57%) — shapes-extra
    │ │ ├───5.40 MB (01.38%) ── tree-tables
    │ │ ├───4.57 MB (01.17%) ++ (2 tiny)
    │ │ └───4.03 MB (01.03%) ── dict-tables
    │ ├───13.22 MB (03.37%) ── cross-compartment-wrappers
    │ ├────3.98 MB (01.01%) ── analysis-temporary
    │ └────0.47 MB (00.12%) ++ (2 tiny)
    ├───44.98 MB (11.46%) — gc-heap
    │ ├──41.35 MB (10.54%) ── decommitted-arenas
    │ └───3.63 MB (00.92%) ++ (3 tiny)
    └────5.54 MB (01.41%) ── runtime

    190.65 MB (100.0%) — js-main-runtime-gc-heap-committed
    ├──117.16 MB (61.45%) — used
    │ ├──112.53 MB (59.03%) ── gc-things
    │ ├────3.63 MB (01.90%) ── chunk-admin
    │ └────1.00 MB (00.53%) ── arena-admin
    └───73.49 MB (38.55%) — unused
    ├──73.49 MB (38.55%) ── gc-things
    └───0.00 MB (00.00%) ++ (2 tiny)

    0 (100.0%) — low-memory-events
    ├──0 (100.0%) ── physical
    └──0 (100.0%) ── virtual

    3.04 MB (100.0%) — window-objects
    ├──1.85 MB (60.96%) — layout
    │ ├──0.93 MB (30.57%) ── style-sets
    │ ├──0.47 MB (15.40%) ── pres-shell
    │ ├──0.22 MB (07.25%) ── frames
    │ ├──0.11 MB (03.54%) ── rule-nodes
    │ ├──0.08 MB (02.65%) ── style-contexts
    │ └──0.05 MB (01.55%) ++ (3 tiny)
    ├──0.62 MB (20.28%) ── style-sheets
    ├──0.57 MB (18.63%) — dom
    │ ├──0.29 MB (09.40%) ── element-nodes
    │ ├──0.19 MB (06.38%) ── other
    │ ├──0.08 MB (02.61%) ── orphan-nodes
    │ └──0.01 MB (00.24%) ++ (3 tiny)
    └──0.00 MB (00.14%) ── property-tables

    0.27 MB ── canvas-2d-pixel-bytes
    634.94 MB ── explicit
    0.00 MB ── gfx-d2d-surfacecache
    0.00 MB ── gfx-d2d-surfacevram
    0.00 MB ── gfx-d2d-vram-drawtarget
    0.00 MB ── gfx-d2d-vram-sourcesurface
    0.01 MB ── gfx-surface-image
    2.04 MB ── gfx-surface-win32
    0 ── ghost-windows
    393.55 MB ── heap-allocated
    568.70 MB ── heap-committed
    175.13 MB ── heap-committed-unused
    44.49% ── heap-committed-unused-ratio
    3.52 MB ── heap-dirty
    438.44 MB ── heap-unused
    0.00 MB ── images-content-used-uncompressed
    232.00 MB ── js-gc-heap
    0 ── low-commit-space-events
    846.71 MB ── private
    747.67 MB ── resident
    12.85 MB ── storage-sqlite
    1,349.55 MB ── vsize

    • Nicholas Nethercote

      This is suspicious:

      │ ├──202.57 MB (32.08%) — top(none)/detached/window([system])

      It looks like a leak, and I suspect one of the add-ons is the cause. To diagnose, you’ll need to selectively disable your add-ons to determine which one is the problem. That’s annoying, I know, but there’s no better way. I’d start with IE Tab 2, and then Ghostery.

      There is also this:

      │ │ │ ├───51.78 MB (08.20%) — compartment([System Principal], file:///C:/Users/TEMP.HGSI.016/AppData/Roaming/Mozilla/Firefox/Profiles/fab9uyrg.default/extensions/firefox@ghostery.com/components/ghostery-content-policy.js)

      50+ MiB for Ghostery, which is not necessarily bad, but quite a bit.

      Nick

      • Nick,

        This entry is suspect as well:

        │ │ ├──202.54 MB (32.07%) — js
        │ │ │ ├──190.98 MB (30.24%) — compartment([System Principal], about:blank)

        Maybe I am misreading this, but why is the blank tab page allocating 190MiB?

        MM

        • Nicholas Nethercote

          That’s directly under the line I quoted, it’s effectively the same thing.

          Note the “[35]” entries below, which indicate there are 35 about:blank compartments present. As I said, it sounds like an add-on leak of some kind.

          • Thanks for the quick response!

            I will try disabling them and browsing like usual but since the browsing session was quite long it might take a while to show again.

            If I can come up with anything suspicious I will let you know =)

  5. It’s always seemed to me as if Ghostery uses more memory than it needs to, although it is stable for me. As far as I know the biggest data user would be a small database (maybe 2000 URLs).

  6. I found ghostery used too much RAM, so changing my ABP filter to fanboy ultimate did pretty much the same thing. Less RAM usage and faster loading.

  7. Is it possible for about:memory to show a ghost window that occurred during a Private Browsing session after this session is over?
    Just wondering, I didn’t use Private Browing, but what if I did, would the ghost window appear ?

    Second topic, I see a ghost window in about:memory (see below) + 20 lines like this one :
    0.20 MB (00.06%) ++ top(about:blank, id=24)/active/window(about:blank)

    Firebug 1.10.6
    Page Speed 1.12.9.1
    Suspend Background Tabs 1.0.1
    United States English Spellchecker 6.0

    ├──127.43 MB (36.12%) — window-objects
    │ ├───30.18 MB (08.55%) — top(none)
    │ │ ├──15.43 MB (04.37%) — ghost
    │ │ │ ├──12.11 MB (03.43%) — window(http://www.eurosport.fr/formule-1/grand-prix-d-abou-dabi/2012/alonso-reduit-son-retard-sur-vettel_sto3480760/story.shtml)
    │ │ │ │ ├──12.07 MB (03.42%) — js/compartment(http://www.eurosport.fr/formule-1/grand-prix-d-abou-dabi/2012/alonso-reduit-son-retard-sur-vettel_sto3480760/story.shtml)
    │ │ │ │ │ ├───7.53 MB (02.13%) ++ gc-heap
    │ │ │ │ │ └───4.54 MB (01.29%) ++ (7 tiny)
    │ │ │ │ └───0.05 MB (00.01%) ++ dom
    │ │ │ └───3.32 MB (00.94%) ++ (17 tiny)
    │ │ └──14.75 MB (04.18%) — detached
    │ │ ├──12.02 MB (03.41%) — window([system])
    │ │ │ ├──11.99 MB (03.40%) — js
    │ │ │ │ ├───6.69 MB (01.90%) — compartment([System Principal], about:blank)
    │ │ │ │ │ ├──3.86 MB (01.09%) ++ gc-heap
    │ │ │ │ │ └──2.83 MB (00.80%) ++ (6 tiny)
    │ │ │ │ ├───4.34 MB (01.23%) ++ compartment(https://www.google.fr/)
    │ │ │ │ └───0.96 MB (00.27%) ++ (3 tiny)
    │ │ │ └───0.03 MB (00.01%) ++ dom
    │ │ └───2.73 MB (00.77%) ++ (5 tiny)

  8. Had a look at Ghostery in about:memory today, and the default view shows the following two items of interest:

    31.16 MB (08.15%) ++ compartment([System Principal], (edit: profile directory)/extensions/firefox@ghostery.com/components/ghostery-content-policy.js)

    8.91 MB (02.33%) — worker(chrome://ghostery/content/ghostery-scanner.js, 7f38a1939000)

    So about 40MB in use for just Ghostery. It is interesting that Adblock Plus, which overlaps in functionality, doesn’t even show up in the default about:memory view. (Could that be included in heap-unclassified?)

    • Hi Bastiaan,

      ABP does show up – as a bootstrap.js around 30mb or so for me.:

      33.45 MB (04.98%) — compartment([System Principal], jar:file:///C:/Users/xxxxx/AppData/Roaming/Mozilla/Firefox/Profiles/xxxxxx.default/extensions/xxxxxx.xpi!/bootstrap.js.

  9. hi i posted a wile ago about fire fox using a lot of memory wen on pages with flash on them and i was saying about it crashing my screenreader. Well i have found a fix to stop all crashes of flash wen used with firefox. what you have to do is turn off Protected Mode, but i don’t no how safe this is. Wen Protected Mode is off i don’t get a single crash wen using fire fox 19 nightly and jaws 13 – 14. Pleas can you let me no how safe this fix is or if you dont no can you ask sum one who will? I am so happy now i can use my fav browser
    with out ending ff’s process in task manager all the time lol and thanks for the updates.