Last Comment Bug 730546 - Readability extension causes memory leaks, with the system compartment growing rapidly
: Readability extension causes memory leaks, with the system compartment growin...
Status: RESOLVED FIXED
[MemShrink:P3][Snappy:P3]
:
Product: Tech Evangelism
Classification: Other
Component: Add-ons (show other bugs)
: unspecified
: x86 Windows 7
: -- normal with 1 vote (vote)
: ---
Assigned To: Nobody; OK to take it and work on it
:
Mentors:
Depends on: 750454 750953
Blocks: LeakyAddons ZombieCompartments
  Show dependency treegraph
 
Reported: 2012-02-24 23:13 PST by DB Cooper
Modified: 2012-05-18 10:07 PDT (History)
13 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---


Attachments

Description DB Cooper 2012-02-24 23:13:14 PST
When the Readability extension is installed and used (on 3 simple pages), much more memory is used after ~ 1 to 2 hours, and the browser becomes less responsive (as recently as 3 weeks ago the browser became near un-useable, but effects are much less severe now). This also causes very long shutdowns.

Much of the increased memory is in the system compartment. About:memory data with and without Readability is included below.

Extension is available here:

http://www.readability.com/apps

about:memory data was copied after closing all tabs except google reader and about:memory. Minimise memory was clicked 3 times and private browsing was entered and exited without loading any pages (~ 2 mins was spent in private browsing, which generally release a lot of memory for some reason).

Without Readability:

After ~80 min of browsing

about:memory

96.20 MB (100.0%) -- explicit
├──51.09 MB (53.10%) -- js
│  ├──30.01 MB (31.20%) -- compartment([System Principal], 0x4773000)
│  │  ├──18.71 MB (19.45%) -- gc-heap
│  │  │  ├───6.68 MB (06.94%) -- arena
│  │  │  │   ├──6.58 MB (06.84%) ── unused
│  │  │  │   └──0.10 MB (00.10%) ++ (2 tiny)
│  │  │  ├───5.65 MB (05.87%) -- objects
│  │  │  │   ├──4.09 MB (04.25%) ── non-function
│  │  │  │   └──1.56 MB (01.62%) ── function
│  │  │  ├───3.76 MB (03.91%) -- shapes
│  │  │  │   ├──1.64 MB (01.70%) ── dict
│  │  │  │   ├──1.38 MB (01.43%) ── tree
│  │  │  │   └──0.74 MB (00.77%) ── base
│  │  │  ├───1.45 MB (01.50%) ── strings
│  │  │  ├───1.10 MB (01.14%) ── scripts
│  │  │  └───0.08 MB (00.08%) ++ (2 tiny)
│  │  ├───4.28 MB (04.45%) ── string-chars
│  │  ├───2.30 MB (02.39%) -- objects
│  │  │   ├──1.92 MB (01.99%) ── slots
│  │  │   └──0.38 MB (00.40%) ++ (2 tiny)
│  │  ├───1.98 MB (02.06%) ── script-data
│  │  ├───1.85 MB (01.92%) ++ shapes-extra
│  │  └───0.90 MB (00.93%) ++ (3 tiny)
│  ├───5.40 MB (05.61%) -- compartment(http://www.google.co.uk/reader/view/?hl=en&tab=wy#stream/feed

%2Fhttp%3A%2F%2Fhg.mozilla.org%2Fmozilla-central%2Fatom-log)
│  │   ├──3.18 MB (03.30%) -- gc-heap
│  │   │  ├──1.99 MB (02.07%) ++ (5 tiny)
│  │   │  └──1.18 MB (01.23%) -- arena
│  │   │     ├──1.16 MB (01.20%) ── unused [2]
│  │   │     └──0.02 MB (00.02%) ++ (2 tiny)
│  │   └──2.22 MB (02.31%) ++ (7 tiny)
│  ├───5.20 MB (05.40%) -- compartment(atoms)
│  │   ├──3.11 MB (03.23%) ── string-chars
│  │   └──2.09 MB (02.17%) -- gc-heap
│  │      ├──1.63 MB (01.69%) ── strings
│  │      └──0.46 MB (00.48%) ++ arena
│  ├───4.70 MB (04.88%) ── gc-heap-decommitted
│  ├───2.52 MB (02.62%) -- runtime
│  │   ├──2.00 MB (02.08%) ── atoms-table
│  │   └──0.52 MB (00.55%) ++ (6 tiny)
│  ├───2.00 MB (02.08%) ++ (9 tiny)
│  └───1.25 MB (01.30%) ++ compartment(https://plus.google.com/u/0/_/nonplus/error/?

hl=en#pid=32&id=gbsf&parent=http%3A%2F%2Fwww.google.co.uk&rpctoken=99676616&_methods=onError

%2ConInfo%2ChideNotificationWidget%2CpostSharedMessage%2CsetNotificationWidgetHeight%2CswitchTo

%2CnavigateTo%2CsetNotificationText%2CsetNotificationAnimation%2ChandlePosted%2C_ready%2C_close

%2C_open%2C_resizeMe)
├──22.98 MB (23.89%) ── heap-unclassified
├──10.91 MB (11.35%) -- storage
│  ├───8.79 MB (09.14%) -- sqlite
│  │   ├──5.29 MB (05.50%) -- places.sqlite
│  │   │  ├──4.93 MB (05.13%) ── cache-used [3]
│  │   │  └──0.36 MB (00.37%) ++ (2 tiny)
│  │   ├──1.84 MB (01.91%) ++ (9 tiny)
│  │   └──1.66 MB (01.73%) ── other
│  └───2.12 MB (02.21%) -- prefixset
│      ├──1.21 MB (01.25%) ── goog-malware-shavar
│      └──0.91 MB (00.95%) ++ (3 tiny)
├───3.84 MB (03.99%) -- layout
│   ├──2.13 MB (02.22%) ++ (5 tiny)
│   └──1.71 MB (01.77%) -- shell(http://www.google.co.uk/reader/view/?hl=en&tab=wy#stream/feed

%2Fhttp%3A%2F%2Fhg.mozilla.org%2Fmozilla-central%2Fatom-log)
│      ├──1.07 MB (01.12%) ── styledata
│      └──0.63 MB (00.66%) ++ (2 tiny)
├───2.21 MB (02.30%) ── spell-check
├───1.61 MB (01.68%) -- dom+style
│   └──1.61 MB (01.68%) -- window-objects
│      ├──1.61 MB (01.68%) -- active
│      │  ├──1.00 MB (01.04%) -- top=956 (inner=961)
│      │  │  ├──0.98 MB (01.02%) ++ inner-window(id=961, uri=http://www.google.co.uk/reader/view/?

hl=en&tab=wy#stream/feed%2Fhttp%3A%2F%2Fhg.mozilla.org%2Fmozilla-central%2Fatom-log)
│      │  │  └──0.02 MB (00.02%) ++ (12 tiny)
│      │  └──0.61 MB (00.64%) ++ (4 tiny)
│      └──0.00 MB (00.00%) ++ other
├───1.25 MB (01.30%) ++ (5 tiny)
├───1.25 MB (01.30%) -- startup-cache
│   ├──1.25 MB (01.30%) ── mapping
│   └──0.00 MB (00.00%) ── data
└───1.06 MB (01.10%) ── atom-table

Other Measurements
  0.19 MB ── canvas-2d-pixel-bytes
  0.56 MB ── dom-total-window
 96.21 MB ── explicit
  0.00 MB ── gfx-d2d-surfacecache
  0.00 MB ── gfx-d2d-surfacevram
  0.01 MB ── gfx-surface-image
  0.43 MB ── gfx-surface-win32
 63.36 MB ── heap-allocated
 81.50 MB ── heap-committed
   22.24% ── heap-committed-fragmentation
  2.12 MB ── heap-dirty
 96.64 MB ── heap-unallocated
        5 ── js-compartments-system
        7 ── js-compartments-user
 30.00 MB ── js-gc-heap
  0.77 MB ── js-main-runtime-analysis-temporary
  8.57 MB ── js-main-runtime-gc-heap-arena-unused
  0.00 MB ── js-main-runtime-gc-heap-chunk-clean-unused
  0.00 MB ── js-main-runtime-gc-heap-chunk-dirty-unused
  4.70 MB ── js-main-runtime-gc-heap-decommitted
    0.53% ── js-main-runtime-gc-heap-unused-fraction
  1.04 MB ── js-main-runtime-mjit
  9.24 MB ── js-main-runtime-objects
  4.80 MB ── js-main-runtime-scripts
  6.53 MB ── js-main-runtime-shapes
 10.57 MB ── js-main-runtime-strings
  0.66 MB ── js-main-runtime-type-inference
        0 ── low-memory-events-physical
        0 ── low-memory-events-virtual
181.20 MB ── private
184.33 MB ── resident
  0.00 MB ── shmem-allocated
  0.00 MB ── shmem-mapped
  8.79 MB ── storage-sqlite
  1.05 MB ── style-sheets-total-window
484.63 MB ── vsize

With Readability:

After ~ 110 mins of browsing.

about:memory

203.90 MB (100.0%) -- explicit
├──144.86 MB (71.05%) -- js
│  ├──106.81 MB (52.38%) -- compartment([System Principal], 0x4773000)
│  │  ├───76.59 MB (37.56%) -- gc-heap
│  │  │   ├──66.82 MB (32.77%) -- objects
│  │  │   │  ├──46.87 MB (22.99%) ── non-function
│  │  │   │  └──19.95 MB (09.78%) ── function
│  │  │   ├───4.20 MB (02.06%) ++ shapes
│  │  │   ├───3.35 MB (01.64%) ++ (4 tiny)
│  │  │   └───2.22 MB (01.09%) ++ arena
│  │  ├───19.64 MB (09.63%) -- objects
│  │  │   ├──14.14 MB (06.94%) ── slots
│  │  │   ├───3.05 MB (01.50%) ── misc
│  │  │   └───2.45 MB (01.20%) ── elements
│  │  ├────4.65 MB (02.28%) ── string-chars
│  │  ├────3.71 MB (01.82%) ++ (4 tiny)
│  │  └────2.22 MB (01.09%) ── script-data
│  ├───19.24 MB (09.44%) ── xpconnect
│  ├────5.48 MB (02.69%) -- compartment(atoms)
│  │    ├──3.24 MB (01.59%) ── string-chars
│  │    └──2.24 MB (01.10%) ++ gc-heap
│  ├────5.36 MB (02.63%) -- compartment(http://www.google.co.uk/)
│  │    ├──2.78 MB (01.36%) ++ gc-heap
│  │    └──2.58 MB (01.27%) ++ (7 tiny)
│  ├────3.33 MB (01.63%) ++ (10 tiny)
│  ├────2.53 MB (01.24%) ++ runtime
│  └────2.13 MB (01.04%) ── gc-heap-decommitted
├───34.29 MB (16.82%) ── heap-unclassified
├───12.95 MB (06.35%) -- storage
│   ├──10.82 MB (05.31%) -- sqlite
│   │  ├───5.47 MB (02.68%) -- places.sqlite
│   │  │   ├──5.09 MB (02.50%) ── cache-used [3]
│   │  │   └──0.39 MB (00.19%) ++ (2 tiny)
│   │  └───5.35 MB (02.62%) ++ (12 tiny)
│   └───2.13 MB (01.04%) ++ prefixset
├────5.58 MB (02.74%) ++ (8 tiny)
├────4.00 MB (01.96%) ++ layout
└────2.21 MB (01.08%) ── spell-check

Other Measurements
  1.31 MB ── canvas-2d-pixel-bytes
  0.63 MB ── dom-total-window
203.91 MB ── explicit
  0.00 MB ── gfx-d2d-surfacecache
  0.00 MB ── gfx-d2d-surfacevram
  0.01 MB ── gfx-surface-image
  1.75 MB ── gfx-surface-win32
114.73 MB ── heap-allocated
133.81 MB ── heap-committed
   14.25% ── heap-committed-fragmentation
  3.77 MB ── heap-dirty
 69.27 MB ── heap-unallocated
        5 ── js-compartments-system
        7 ── js-compartments-user
 86.00 MB ── js-gc-heap
  1.50 MB ── js-main-runtime-analysis-temporary
  3.64 MB ── js-main-runtime-gc-heap-arena-unused
  0.00 MB ── js-main-runtime-gc-heap-chunk-clean-unused
  0.00 MB ── js-main-runtime-gc-heap-chunk-dirty-unused
  2.13 MB ── js-main-runtime-gc-heap-decommitted
    0.03% ── js-main-runtime-gc-heap-unused-fraction
  1.20 MB ── js-main-runtime-mjit
 87.76 MB ── js-main-runtime-objects
  5.18 MB ── js-main-runtime-scripts
  7.11 MB ── js-main-runtime-shapes
 11.69 MB ── js-main-runtime-strings
  0.95 MB ── js-main-runtime-type-inference
        0 ── low-memory-events-physical
        0 ── low-memory-events-virtual
293.55 MB ── private
299.88 MB ── resident
  0.00 MB ── shmem-allocated
  0.00 MB ── shmem-mapped
 10.82 MB ── storage-sqlite
  1.05 MB ── style-sheets-total-window
581.61 MB ── vsize

About support information:

Application Basics

        Name
        Firefox

        Version
        13.0a1

        User Agent
        Mozilla/5.0 (Windows NT 6.1; rv:13.0a1) Gecko/20120218 Firefox/13.0a1

        *real user agent is 20120224*

  Extensions

        Name

        Version

        Enabled

        ID

        about:jank
        0.5
        true
        about.blank@mozilla.com

        Adblock Plus
        2.0.4a.3413
        true
        {d10d0bf8-f5b5-c8b4-a8b2-2b9879e08c5d}

        British English Dictionary
        1.19.1
        true
        en-GB@dictionaries.addons.mozilla.org

        Close Tab By Double Click
        1.14
        true
        close@doubleclick

        Element Hiding Helper for Adblock Plus
        1.2.2a.407
        true
        elemhidehelper@adblockplus.org

        Nightly Tester Tools
        3.2.1.1
        true
        {8620c15f-30dc-4dba-a131-7c5d20cf4a29}

        NoScript
        2.3.2rc6
        true
        {73a6fe31-595d-460b-a920-fcc0f8843232}

        Adobe Acrobat - Create PDF
        1.2
        false
        web2pdfextension@web2pdf.adobedotcom

        Readability
        2.1
        false
        readability@readability.com

        Zotero
        3.0.3
        false
        zotero@chnm.gmu.edu

  Important Modified Preferences

      Name

      Value

        accessibility.typeaheadfind.flashBar
        0

        browser.cache.disk.smart_size.enabled
        false

        browser.cache.disk.smart_size.first_run
        false

        browser.cache.disk.smart_size_cached_value
        1048576

        browser.places.smartBookmarksVersion
        2

        browser.startup.homepage
        http://www.google.co.uk

        browser.startup.homepage_override.buildID
        20120224031039

        browser.startup.homepage_override.mstone
        13.0a1

        extensions.checkCompatibility
        false

        extensions.checkCompatibility.3.6
        false

        extensions.checkCompatibility.3.6b
        false

        extensions.checkCompatibility.3.6p
        false

        extensions.checkCompatibility.3.6pre
        false

        extensions.checkCompatibility.3.7a
        false

        extensions.checkCompatibility.4.0b
        false

        extensions.checkCompatibility.4.0p
        false

        extensions.checkCompatibility.4.0pre
        false

        extensions.checkCompatibility.4.2
        false

        extensions.checkCompatibility.4.2a
        false

        extensions.checkCompatibility.4.2a1
        false

        extensions.checkCompatibility.4.2a1pre
        false

        extensions.checkCompatibility.4.2b
        false

        extensions.checkCompatibility.5.0
        false

        extensions.checkCompatibility.5.0a
        false

        extensions.checkCompatibility.5.0b
        false

        extensions.checkCompatibility.6.0
        false

        extensions.checkCompatibility.6.0a
        false

        extensions.checkCompatibility.6.0b
        false

        extensions.checkCompatibility.7.0
        false

        extensions.checkCompatibility.7.0a
        false

        extensions.checkCompatibility.7.0b
        false

        extensions.checkCompatibility.nightly
        false

        extensions.lastAppVersion
        13.0a1

        general.useragent.override
        Mozilla/5.0 (Windows NT 6.1; rv:13.0a1) Gecko/20120218 Firefox/13.0a1

        gfx.content.azure.enabled
        false

        gfx.direct2d.disabled
        true

        gfx.direct3d.prefer_10_1
        true

        gfx.font_rendering.cleartype_params.force_gdi_classic_for_families
        Arial,Courier New,Tahoma,Trebuchet MS,Verdana,Segoe UI,Lucida Grande

        network.cookie.cookieBehavior
        1

        network.cookie.prefsMigrated
        true

        network.prefetch-next
        false

        places.database.lastMaintenance
        1329888380

        places.history.expiration.transient_current_max_pages
        69886

        places.history.expiration.transient_optimal_database_size
        111816048

        privacy.donottrackheader.enabled
        true

        privacy.popups.showBrowserMessage
        false

        privacy.sanitize.migrateFx3Prefs
        true

        security.warn_viewing_mixed
        false

  Graphics

        Adapter Description
        AMD Radeon HD 6310 Graphics

        Vendor ID
        0x1002

        Device ID
        0x9802

        Adapter RAM
        384

        Adapter Drivers
        aticfx32 aticfx32 aticfx32 atiumdag atidxx32 atiumdva

        Driver Version
        8.930.0.0

        Driver Date
        12-5-2011

        Direct2D Enabled
        false

        DirectWrite Enabled
        false (6.1.7601.17563)

        ClearType Parameters
        ClearType parameters not found

        WebGL Renderer
        Google Inc. -- ANGLE (AMD Radeon HD 6310 Graphics) -- OpenGL ES 2.0 (ANGLE 1.0.0.963)

        GPU Accelerated Windows
        1/1 Direct3D 9

  JavaScript

        Incremental GC
        0
Comment 1 DB Cooper 2012-02-24 23:22:59 PST
ps. Memory usage usually remains under 200,000k for the conditions described above.

About:compartments without Readability

about: [2]
http://www.google.co.uk/reader/view/?hl=en&tab=wy#stream/feed%2Fhttp%3A%2F%2Fhg.mozilla.org

%2Fmozilla-central%2Fatom-log [2]
https://plus.google.com/u/0/_/nonplus/error/?hl=en#pid=32&id=gbsf&parent=http%3A%2F

%2Fwww.google.co.uk&rpctoken=99676616&_methods=onError%2ConInfo%2ChideNotificationWidget

%2CpostSharedMessage%2CsetNotificationWidgetHeight%2CswitchTo%2CnavigateTo%2CsetNotificationText

%2CsetNotificationAnimation%2ChandlePosted%2C_ready%2C_close%2C_open%2C_resizeMe [2]

System Compartments
[System Principal] [4]
atoms
moz-nullprincipal:{20a6db68-fe78-4a7b-bad9-9f658f296a47}

About:compartments with Readability

User Compartments
about: [2]
http://www.google.co.uk/
http://www.google.co.uk/reader/view/?hl=en&tab=wy#stream/feed%2Fhttp%3A%2F%2Fhg.mozilla.org

%2Fmozilla-central%2Fatom-log
https://plus.google.com/u/0/_/nonplus/error/?hl=en#pid=32&id=gbsf&parent=http%3A%2F

%2Fwww.google.co.uk&rpctoken=906446467&_methods=onError%2ConInfo%2ChideNotificationWidget

%2CpostSharedMessage%2CsetNotificationWidgetHeight%2CswitchTo%2CnavigateTo%2CsetNotificationText

%2CsetNotificationAnimation%2ChandlePosted%2C_ready%2C_close%2C_open%2C_resizeMe [2]

System Compartments
[System Principal] [5]
atoms
moz-nullprincipal:{2be53b18-2286-4aff-870d-c0efdd94ec87}

about:jank without Readability, taken after exiting private browsing

(6650 samples)

1055 - c-GC::GarbageCollectNow
905 - c-Timer::Fire
758 - c-JS::CallEventHandler
753 - c-PluginModuleParent::NPP_NewStream
518 - c-nsEventListenerManager::HandleEventInternal
418 - c-JS::EvaluateString
395 - c-layout::DoReflow
339 - c-html5::RunFlushLoop
323 - c-CSS::ProcessRestyles
260 - c-layout::FlushPendingNotifications
218 - c-network::nsHttpChannel::OnStopRequest
191 - c-nsPluginStreamListenerPeer::OnStartRequest
165 - c-gfx::DrawThebesLayer
80 - c-CC::nsCycleCollector_collect
72 - c-nsHttpChannel::OnStartRequest
59 - c-image::imgFrame::Draw
57 - c-Paint::PresShell::Paint
51 - c-JS::EvaluateStringWithValue
15 - c-CC::nsCycleCollector_forgetSkippable
7 - c-event::nsViewManager::DispatchEvent
6 - c-storage::Statement::ExecuteStep
2 - c-network::nsHttpChannel::OnDataAvailable
1 - c-nsObjectLoadingContent::OnStartRequest
1 - c-storage::Connection::initialize
1 - c-layout::nsLayoutUtils::DrawBackgroundImage

about:jank with Readability, taken after exiting private browsing

(5116 samples)

2567 - c-GC::GarbageCollectNow
865 - c-JS::CallEventHandler
560 - c-nsEventListenerManager::HandleEventInternal
260 - c-Timer::Fire
237 - c-JS::EvaluateString
177 - c-CC::nsCycleCollector_collect
145 - c-layout::FlushPendingNotifications
90 - c-layout::DoReflow
83 - c-CSS::ProcessRestyles
38 - c-gfx::DrawThebesLayer
38 - c-CC::nsCycleCollector_forgetSkippable
22 - c-nsHttpChannel::OnStartRequest
12 - c-html5::RunFlushLoop
12 - c-image::imgFrame::Draw
5 - c-Paint::PresShell::Paint
3 - c-event::nsViewManager::DispatchEvent
1 - c-storage::Connection::initialize
1 - c-network::nsHttpChannel::OnStopRequest

about:jank with Readability, taken before entering private browsing

(27368 samples)

7861 - c-GC::GarbageCollectNow
5721 - c-nsEventListenerManager::HandleEventInternal
2563 - c-JS::CallEventHandler
2083 - c-Timer::Fire
2043 - c-PluginModuleParent::NPP_NewStream
1522 - c-layout::DoReflow
1150 - c-gfx::DrawThebesLayer
919 - c-layout::FlushPendingNotifications
726 - c-html5::RunFlushLoop
514 - c-JS::EvaluateString
486 - c-CSS::ProcessRestyles
469 - c-image::imgFrame::Draw
419 - c-Paint::PresShell::Paint
240 - c-network::nsHttpChannel::OnStopRequest
182 - c-CC::nsCycleCollector_collect
157 - c-network::nsHttpChannel::OnDataAvailable
112 - c-JS::EvaluateStringWithValue
86 - c-nsHttpChannel::OnStartRequest
50 - c-event::nsViewManager::DispatchEvent
46 - c-CC::nsCycleCollector_forgetSkippable
6 - c-storage::Statement::ExecuteStep
5 - c-Input::DispatchMouseEvent
4 - c-nsPluginStreamListenerPeer::OnStartRequest
2 - c-layout::nsLayoutUtils::DrawBackgroundImage
1 - c-Input::nsInputStreamPump::OnStateTransfer
1 - c-network::nsStreamLoader::OnStopRequest
Comment 2 Nicholas Nethercote [:njn] (on vacation until July 11) 2012-02-25 15:45:13 PST
Thanks for the detailed report.

> When the Readability extension is installed and used (on 3 simple
> pages), much more memory is used after ~ 1 to 2 hours, and the browser 
> becomes less responsive (as recently as 3 weeks ago the browser became
> near un-useable, but effects are much less severe now). This also
> causes very long shutdowns.

The increase in memory consumption isn't good, but you only saw ~100MB of extra memory usage which is unlikely to be enough to cause paging.  So the responsiveness issues are likely to be caused by something else.  (That "something else" probably correlates with, but isn't caused by, the higher memory usage.)


> With Readability:
> 
> After ~ 110 mins of browsing.
> 
> │  ├───19.24 MB (09.44%) ── xpconnect

That's a curiously high xpconnect measurement.  I'm not sure what to make of it.  Maybe this add-on is doing lots of communication between C++ and JS?

 
> About support information:
> 
>         Readability
>         2.1
>         false
>         readability@readability.com

The "false" indicates that Readability is disabled.  I assume you took this about:support copy after disabling the add-on?
Comment 3 DB Cooper 2012-02-25 16:07:16 PST
Thanks for looking at this.

Yeah, I took the about:support info after Readability was disabled. 

Perhaps some of the responsiveness issue is caused by some sort of failing GC? GC is up a lot in the last about:jank survey, and that might explain the increasing/unreleased memory?

I submitted a support email to the Readability site, including the bug URL, but that might be a bit slow to get a response.
Comment 4 Nicholas Nethercote [:njn] (on vacation until July 11) 2012-02-25 16:14:58 PST
I don't know what you mean by "failing GC".  But given the xpconnect numbers, I could believe that whatever data structures Readability is maintaining are causing difficulties for the cycle collector.  I've CC'd some cycle collector experts.
Comment 5 Andrew McCreight (PTO-ish through 6-29) [:mccr8] 2012-02-25 16:18:11 PST
Cycle collector is pretty low in about:jank, so that's probably not the problem.
Comment 6 DB Cooper 2012-02-25 16:23:02 PST
Sorry, to be more clear I meant that Readability might be preventing the garbage collector from clearing certain elements, so the heap gets bigger and processing it takes longer, resulting in GC making up a higher proportion of jank (~ 1/2 of events in the last about:jank report vs. ~ 1/4 in the early one, and ~ 1/6 without  Readability).
Comment 7 DB Cooper 2012-02-28 21:17:36 PST
I contacted Readability's support system and got a reply that they check out this bug report.
Comment 8 Jorge Villalobos [:jorgev] 2012-03-08 09:44:21 PST
FWIW, I tested the add-on for a while and couldn't get it to create any zombie compartments.
Comment 9 DB Cooper 2012-03-08 15:20:30 PST
Hi Jorge, I didn't see Zombie Compartments with it, rather a large increase in the system compartment and in xpconnect.
Comment 10 Philip Forget 2012-03-29 11:02:18 PDT
Hello everyone, my name is Philip. I'm the developer of the extension. I'm trying to debug this right now but I'm having a hard time getting my memory usage up to replicate. I have two instances of firefox running with different profiles, one with readability and one without, and I can't see any difference in their memory usage after an hour of using both. 

As for xpconnect, I don't use anything but js in the extension.
Comment 11 DB Cooper 2012-04-01 23:18:59 PDT
(In reply to Philip Forget from comment #10)
> Hello everyone, my name is Philip. I'm the developer of the extension. I'm
> trying to debug this right now but I'm having a hard time getting my memory
> usage up to replicate. I have two instances of firefox running with
> different profiles, one with readability and one without, and I can't see
> any difference in their memory usage after an hour of using both. 
> 
> As for xpconnect, I don't use anything but js in the extension.


Hi Philip, I don't see a big difference until after ~ 1 hour, but by 2 hours of use I do see quite a big difference. 

I reproduced the leak after 2 hours of browsing, with the same settings as above. I used the add-on on about 8 pages, and sent one to my kindle.

about:memory (with readability) after closing all tabs except it and google reader and hitting minimise memory 3 times:

Explicit Allocations
343.20 MB (100.0%) -- explicit
├──269.74 MB (78.59%) -- js
│  ├──199.36 MB (58.09%) -- compartment([System Principal], 0x4986000)
│  │  ├──148.52 MB (43.27%) -- gc-heap
│  │  │  ├──136.52 MB (39.78%) -- objects
│  │  │  │  ├──117.43 MB (34.22%) ── non-function
│  │  │  │  └───19.09 MB (05.56%) ── function
│  │  │  ├────4.91 MB (01.43%) -- arena
│  │  │  │    ├──4.20 MB (01.22%) ── unused
│  │  │  │    └──0.72 MB (00.21%) ++ (2 tiny)
│  │  │  ├────4.17 MB (01.21%) ++ shapes
│  │  │  └────2.92 MB (00.85%) ++ (4 tiny)
│  │  ├───41.50 MB (12.09%) -- objects
│  │  │   ├──37.10 MB (10.81%) ── slots
│  │  │   ├───4.37 MB (01.27%) ── elements
│  │  │   └───0.02 MB (00.01%) ── misc
│  │  ├────5.87 MB (01.71%) ++ (5 tiny)
│  │  └────3.48 MB (01.01%) ── string-chars
│  ├───24.85 MB (07.24%) ── xpconnect
│  ├───16.73 MB (04.88%) ── gc-heap-decommitted
│  ├───11.68 MB (03.40%) -- compartment(http://www.google.co.uk/reader/view/?hl=en&tab=wy#stream/feed%2Fhttp%3A%2F%2Fhg.mozilla.org%2Fmozilla-central%2Fatom-log)
│  │   ├───7.44 MB (02.17%) ++ gc-heap
│  │   └───4.23 MB (01.23%) ++ (7 tiny)
│  ├───11.17 MB (03.25%) ++ (11 tiny)
│  └────5.94 MB (01.73%) -- compartment(atoms)
│       ├──3.46 MB (01.01%) ── string-chars
│       └──2.48 MB (00.72%) ++ gc-heap
├───37.84 MB (11.02%) ── heap-unclassified
├───15.47 MB (04.51%) -- storage
│   ├──12.94 MB (03.77%) -- sqlite
│   │  ├───8.07 MB (02.35%) ++ (12 tiny)
│   │  └───4.88 MB (01.42%) -- places.sqlite
│   │      ├──4.49 MB (01.31%) ── cache-used [4]
│   │      └──0.39 MB (00.11%) ++ (2 tiny)
│   └───2.53 MB (00.74%) ++ prefixset
├────9.90 MB (02.88%) ++ (9 tiny)
├────6.65 MB (01.94%) -- window-objects
│    ├──4.54 MB (01.32%) -- top(http://www.google.co.uk/reader/view/?hl=en&tab=wy#stream/feed%2Fhttp%3A%2F%2Fhg.mozilla.org%2Fmozilla-central%2Fatom-log, id=8)
│    │  └──4.54 MB (01.32%) ++ active
│    └──2.11 MB (00.62%) ++ (4 tiny)
└────3.61 MB (01.05%) ++ gfx

Other Measurements
  0.50 MB ── canvas-2d-pixel-bytes
343.20 MB ── explicit
  0.00 MB ── gfx-d2d-surfacecache
  0.00 MB ── gfx-d2d-surfacevram
  0.00 MB ── gfx-surface-image
  1.02 MB ── gfx-surface-win32
158.60 MB ── heap-allocated
194.36 MB ── heap-committed
   18.39% ── heap-committed-fragmentation
  3.52 MB ── heap-dirty
115.40 MB ── heap-unallocated
  0.07 MB ── images-content-used-uncompressed
        4 ── js-compartments-system
       11 ── js-compartments-user
181.00 MB ── js-gc-heap
  0.64 MB ── js-main-runtime-analysis-temporary
  7.41 MB ── js-main-runtime-gc-heap-arena-unused
  0.00 MB ── js-main-runtime-gc-heap-chunk-clean-unused
  0.00 MB ── js-main-runtime-gc-heap-chunk-dirty-unused
 16.73 MB ── js-main-runtime-gc-heap-decommitted
    0.21% ── js-main-runtime-gc-heap-unused-fraction
  1.34 MB ── js-main-runtime-mjit
182.63 MB ── js-main-runtime-objects
  6.83 MB ── js-main-runtime-scripts
 11.65 MB ── js-main-runtime-shapes
 10.53 MB ── js-main-runtime-strings
  0.56 MB ── js-main-runtime-type-inference
        0 ── low-commit-space-events
        0 ── low-memory-events-physical
        0 ── low-memory-events-virtual
450.57 MB ── private
439.61 MB ── resident
  0.00 MB ── shmem-allocated
  0.00 MB ── shmem-mapped
 12.94 MB ── storage-sqlite
776.97 MB ── vsize
  0.84 MB ── window-objects-dom
  1.70 MB ── window-objects-layout-arenas
  3.08 MB ── window-objects-layout-style-sets
  0.00 MB ── window-objects-layout-text-runs
  1.03 MB ── window-objects-style-sheets

After a couple of minutes more browsing, but no more use of readability, I expanded the "tiny compartments" which revealed a zombie readability compartments:

14.08 MB (04.10%) -- (13 tiny)
│  │   ├───2.85 MB (00.83%) ++ runtime
│  │   ├───2.73 MB (00.79%) ++ compartment(http://www.readability.com/articles/hfctj9al)
│  │   ├───2.67 MB (00.78%) ── gc-heap-chunk-admin
│  │   ├───2.62 MB (00.76%) ── gc-heap-decommitted
│  │   ├───2.05 MB (00.60%) ++ compartment(https://plus.google.com/u/0/_/nonplus/error/?hl=en#pid=32&id=gbsf&parent=http%3A%2F%2Fwww.google.co.uk&rpctoken=307789812&_methods=onError%2ConInfo%2ChideNotificationWidget%2CpostSharedMessage%2CsetNotificationWidgetHeight%2CswitchTo%2CnavigateTo%2CsetNotificationText%2CsetNotificationAnimation%2ChandlePosted%2C_ready%2C_close%2C_open%2C_resizeMe%2C_renderstart)
│  │   ├───0.39 MB (00.11%) ++ compartment([System Principal], jar:file:///C:/Users/Main/AppData/Roaming/Mozilla/Firefox/Profiles/nqagvbe0.default/extensions/elemhidehelper@adblockplus.org.xpi!/bootstrap.js, 0x5bc0000)
│  │   ├───0.23 MB (00.07%) ++ compartment([System Principal], NoScript::ScriptSurrogate@about:memory, 0xecb4000)
│  │   ├───0.20 MB (00.06%) ── gc-heap-chunk-dirty-unused
│  │   ├───0.10 MB (00.03%) ++ compartment([System Principal], NoScript::ScriptSurrogate@about:memory, 0xe20d000)
│  │   ├───0.10 MB (00.03%) ++ compartment(https://plus.google.com/u/0/_/nonplus/error/?hl=en#pid=1&id=gbsf&parent=https%3A%2F%2Fwww.google.co.uk&rpctoken=347150699&_methods=onError%2ConInfo%2ChideNotificationWidget%2CpostSharedMessage%2CsetNotificationWidgetHeight%2CswitchTo%2CnavigateTo%2CsetNotificationText%2CsetNotificationAnimation%2ChandlePosted%2C_ready%2C_close%2C_open%2C_resizeMe%2C_renderstart)
│  │   ├───0.10 MB (00.03%) ++ compartment(about:)
│  │   ├───0.03 MB (00.01%) ++ compartment(moz-nullprincipal:{e6b595dc-6cf8-4907-9cf2-45f7790a7d2f})
│  │   └───0.00 MB (00.00%) ── gc-heap-chunk-clean-unused

Memory use was double what I normally see, the browser was slow and unresponsive, and took several minutes to shut down.

I do use adblock plus and no-script. I have seen this problem without no-script though.
Comment 12 Philip Forget 2012-04-02 07:37:53 PDT
Hey DB. Thanks so much for the detailed report. I think it might actually be our pages that have a memory leak. Perhaps a circular reference to a dom element that isn't allowing the GC to clean it up. Are you allowing scripts to run from our domain? I'm going to have a go at reproducing this today. I wonder if you could try and see if the bookmarklets ( http://www.readability.com/bookmarklets ) end up giving you the same results. Once again, I greatly appreciate you taking the time to report this, and I'll do my best to get it resolved as quickly as possible.
Comment 13 DB Cooper 2012-04-03 21:30:23 PDT
(In reply to Philip Forget from comment #12)
> Hey DB. Thanks so much for the detailed report. I think it might actually be
> our pages that have a memory leak. Perhaps a circular reference to a dom
> element that isn't allowing the GC to clean it up. Are you allowing scripts
> to run from our domain? I'm going to have a go at reproducing this today. I
> wonder if you could try and see if the bookmarklets (
> http://www.readability.com/bookmarklets ) end up giving you the same
> results. Once again, I greatly appreciate you taking the time to report
> this, and I'll do my best to get it resolved as quickly as possible.

Hi Philip, I am allowing scripts to run from your domain. I'll try to reproduce the leaks with just the bookmarklets this week.
Comment 14 Justin Lebar (not reading bugmail) 2012-04-03 21:50:49 PDT
> Perhaps a circular reference to a dom element that isn't allowing the GC to clean it up. 

The GC happily collects objects with circular references.
Comment 15 DB Cooper 2012-04-05 20:01:00 PDT
After ~ 210 min browsing while using the bookmarklets (extension disabled) I could not reproduce the leaks seen with the extension.

Test was done on a different machine (win7 64bit) with a synced profile and the same extensions (and the same filters/white-lists). D2D was on with this FF, and the version was today's nightly moz-central win32 build

about:memory info below (taken after clicking "minimise" and entering and exiting private browsing):

Explicit Allocations
135.17 MB (100.0%) -- explicit
├───79.00 MB (58.45%) -- js
│   ├──38.57 MB (28.53%) -- compartment([System Principal], 0x7285000)
│   │  ├──26.30 MB (19.46%) -- gc-heap
│   │  │  ├──12.00 MB (08.88%) -- arena
│   │  │  │  ├──11.86 MB (08.78%) ── unused
│   │  │  │  └───0.14 MB (00.10%) ++ (2 tiny)
│   │  │  ├───6.22 MB (04.60%) -- objects
│   │  │  │   ├──4.45 MB (03.30%) ── non-function
│   │  │  │   └──1.77 MB (01.31%) ── function
│   │  │  ├───4.98 MB (03.69%) -- shapes
│   │  │  │   ├──2.61 MB (01.93%) ── dict
│   │  │  │   ├──1.66 MB (01.23%) ── tree
│   │  │  │   └──0.71 MB (00.53%) ── base
│   │  │  ├───1.76 MB (01.30%) ── strings
│   │  │  └───1.34 MB (00.99%) ++ (3 tiny)
│   │  ├───3.32 MB (02.45%) ── script-data
│   │  ├───2.98 MB (02.21%) -- objects
│   │  │   ├──2.62 MB (01.94%) ── slots
│   │  │   └──0.36 MB (00.27%) ++ (2 tiny)
│   │  ├───2.82 MB (02.09%) ++ shapes-extra
│   │  ├───2.61 MB (01.93%) ── string-chars
│   │  └───0.53 MB (00.39%) ++ (3 tiny)
│   ├──21.98 MB (16.26%) ── gc-heap-decommitted
│   ├───6.48 MB (04.80%) -- compartment(atoms)
│   │   ├──3.74 MB (02.76%) ── string-chars
│   │   └──2.75 MB (02.03%) -- gc-heap
│   │      ├──1.90 MB (01.41%) ── strings
│   │      └──0.84 MB (00.62%) ++ arena
│   ├───5.40 MB (03.99%) -- compartment(http://www.google.co.uk/reader/view/?hl=en&tab=wy#stream/feed%2Fhttp%3A%2F%2Fhg.mozilla.org%2Fmozilla-central%2Fatom-log)
│   │   ├──3.20 MB (02.36%) ++ gc-heap
│   │   └──2.20 MB (01.63%) ++ (7 tiny)
│   ├───3.93 MB (02.91%) -- (9 tiny)
│   │   ├──1.32 MB (00.97%) ++ compartment(https://plus.google.com/u/0/_/nonplus/error/?hl=en#pid=32&id=gbsf&parent=http%3A%2F%2Fwww.google.co.uk&rpctoken=385763558&_methods=onError%2ConInfo%2ChideNotificationWidget%2CpostSharedMessage%2CsetNotificationWidgetHeight%2CswitchTo%2CnavigateTo%2CsetNotificationText%2CsetNotificationAnimation%2ChandlePosted%2C_ready%2C_close%2C_open%2C_resizeMe%2C_renderstart)
│   │   ├──1.12 MB (00.83%) ── xpconnect
│   │   ├──0.88 MB (00.65%) ── gc-heap-chunk-admin
│   │   ├──0.38 MB (00.28%) ++ compartment([System Principal], jar:file:///D:/SSD/Users/Main/AppData/Roaming/Mozilla/Firefox/Profiles/fkb58i6p.default/extensions/elemhidehelper@adblockplus.org.xpi!/bootstrap.js, 0x815e000)
│   │   ├──0.10 MB (00.08%) ++ compartment([System Principal], NoScript::ScriptSurrogate@about:memory, 0x8616000)
│   │   ├──0.09 MB (00.07%) ++ compartment(about:)
│   │   ├──0.03 MB (00.03%) ++ compartment(moz-nullprincipal:{30bd8cd0-90ca-4d55-9918-446d31514023})
│   │   ├──0.00 MB (00.00%) ── gc-heap-chunk-dirty-unused
│   │   └──0.00 MB (00.00%) ── gc-heap-chunk-clean-unused
│   └───2.65 MB (01.96%) -- runtime
│       ├──2.00 MB (01.48%) ── atoms-table
│       └──0.65 MB (00.48%) ++ (7 tiny)
├───25.79 MB (19.08%) ── heap-unclassified
├───16.05 MB (11.88%) -- storage
│   ├──14.41 MB (10.66%) -- sqlite
│   │  ├───7.73 MB (05.72%) -- places.sqlite
│   │  │   ├──7.32 MB (05.41%) ── cache-used [4]
│   │  │   └──0.41 MB (00.30%) ++ (2 tiny)
│   │  ├───2.51 MB (01.86%) ++ (9 tiny)
│   │  ├───2.39 MB (01.77%) ── other
│   │  └───1.78 MB (01.32%) -- extensions.sqlite
│   │      ├──1.60 MB (01.18%) ── cache-used
│   │      └──0.18 MB (00.13%) ++ (2 tiny)
│   └───1.64 MB (01.21%) ++ prefixset
├────6.65 MB (04.92%) -- window-objects
│    ├──4.38 MB (03.24%) -- top(http://www.google.co.uk/reader/view/?hl=en&tab=wy#stream/feed%2Fhttp%3A%2F%2Fhg.mozilla.org%2Fmozilla-central%2Fatom-log, id=3990)
│    │  └──4.38 MB (03.24%) -- active
│    │     ├──3.11 MB (02.30%) -- window(http://www.google.co.uk/reader/view/?hl=en&tab=wy#stream/feed%2Fhttp%3A%2F%2Fhg.mozilla.org%2Fmozilla-central%2Fatom-log)
│    │     │  ├──2.07 MB (01.53%) -- layout
│    │     │  │  ├──1.43 MB (01.06%) ── style-sets
│    │     │  │  └──0.64 MB (00.47%) ++ (2 tiny)
│    │     │  └──1.04 MB (00.77%) ++ (2 tiny)
│    │     └──1.27 MB (00.94%) ++ (2 tiny)
│    ├──1.84 MB (01.36%) -- top(chrome://browser/content/browser.xul, id=1)
│    │  └──1.84 MB (01.36%) -- active
│    │     ├──1.83 MB (01.36%) ++ window(chrome://browser/content/browser.xul)
│    │     └──0.01 MB (00.00%) ++ window(about:blank)
│    └──0.42 MB (00.31%) ++ (3 tiny)
├────3.05 MB (02.26%) ++ (7 tiny)
├────1.83 MB (01.36%) ── spell-check
├────1.40 MB (01.04%) -- startup-cache
│    ├──1.40 MB (01.04%) ── mapping
│    └──0.00 MB (00.00%) ── data
└────1.39 MB (01.03%) ── atom-table

Other Measurements
  1.23 MB ── canvas-2d-pixel-bytes
135.17 MB ── explicit
  1.08 MB ── gfx-d2d-surfacecache
 15.60 MB ── gfx-d2d-surfacevram
  1.30 MB ── gfx-surface-image
        0 ── ghost-windows
 76.27 MB ── heap-allocated
119.14 MB ── heap-committed
   35.97% ── heap-committed-fragmentation
  3.46 MB ── heap-dirty
237.73 MB ── heap-unallocated
  0.00 MB ── images-content-used-uncompressed
        4 ── js-compartments-system
        7 ── js-compartments-user
 56.00 MB ── js-gc-heap
  0.30 MB ── js-main-runtime-analysis-temporary
 14.28 MB ── js-main-runtime-gc-heap-arena-unused
  0.00 MB ── js-main-runtime-gc-heap-chunk-clean-unused
  0.00 MB ── js-main-runtime-gc-heap-chunk-dirty-unused
 21.98 MB ── js-main-runtime-gc-heap-decommitted
    0.37% ── js-main-runtime-gc-heap-unused-fraction
  1.15 MB ── js-main-runtime-mjit
 10.63 MB ── js-main-runtime-objects
  6.31 MB ── js-main-runtime-scripts
  8.80 MB ── js-main-runtime-shapes
 10.12 MB ── js-main-runtime-strings
  0.37 MB ── js-main-runtime-type-inference
        0 ── low-commit-space-events
        0 ── low-memory-events-physical
        0 ── low-memory-events-virtual
261.60 MB ── private
323.33 MB ── resident
  0.00 MB ── shmem-allocated
  0.00 MB ── shmem-mapped
 14.41 MB ── storage-sqlite
809.95 MB ── vsize
  0.76 MB ── window-objects-dom
  1.78 MB ── window-objects-layout-arenas
  3.08 MB ── window-objects-layout-style-sets
  0.00 MB ── window-objects-layout-text-runs
  1.02 MB ── window-objects-style-sheets
Comment 16 Jorge Villalobos [:jorgev] 2012-04-18 15:03:53 PDT
Philip: do you have any updates on this bug? Also, is version 2.2 going to the uploaded to AMO, or are you only updating your add-on on your own site?
Comment 17 DB Cooper 2012-04-18 20:44:59 PDT
After a couple of hours browsing with v2.2 I am still seeing leaks (no zombie compartments though) - system principal compartment is big, and xpconnect is much bigger than normal too.

With about:memory and google reader tabs open, after clicking minimise:

Explicit Allocations
279.45 MB (100.0%) -- explicit
├──206.54 MB (73.91%) -- js
│  ├──143.75 MB (51.44%) -- compartment([System Principal], 0x7386000)
│  │  ├──107.13 MB (38.34%) -- gc-heap
│  │  │  ├───91.67 MB (32.80%) -- objects
│  │  │  │   ├──78.47 MB (28.08%) ── non-function
│  │  │  │   └──13.20 MB (04.72%) ── function
│  │  │  ├────7.39 MB (02.64%) -- arena
│  │  │  │    ├──6.88 MB (02.46%) ── unused
│  │  │  │    └──0.51 MB (00.18%) ++ (2 tiny)
│  │  │  ├────5.07 MB (01.81%) ++ shapes
│  │  │  └────3.01 MB (01.08%) ++ (4 tiny)
│  │  ├───27.96 MB (10.00%) -- objects
│  │  │   ├──25.53 MB (09.13%) ── slots
│  │  │   └───2.43 MB (00.87%) ++ (2 tiny)
│  │  ├────5.43 MB (01.94%) ++ (5 tiny)
│  │  └────3.24 MB (01.16%) ── script-data
│  ├───20.27 MB (07.25%) ── gc-heap-decommitted
│  ├───15.81 MB (05.66%) ── xpconnect
│  ├───13.13 MB (04.70%) -- compartment(http://www.google.co.uk/reader/view/?hl=en&tab=wy#stream/feed%2Fhttp%3A%2F%2Fhg.mozilla.org%2Fmozilla-central%2Fatom-log)
│  │   ├───8.46 MB (03.03%) -- gc-heap
│  │   │   ├──5.36 MB (01.92%) ++ (5 tiny)
│  │   │   └──3.10 MB (01.11%) ++ shapes
│  │   └───4.66 MB (01.67%) ++ (7 tiny)
│  ├────7.08 MB (02.54%) -- (12 tiny)
│  │    ├──2.65 MB (00.95%) ++ runtime
│  │    ├──2.22 MB (00.79%) ── gc-heap-chunk-admin
│  │    ├──1.22 MB (00.44%) ++ compartment(https://plus.google.com/u/0/_/nonplus/error/?hl=en#pid=32&id=gbsf&parent=http%3A%2F%2Fwww.google.co.uk&rpctoken=727131429&_methods=onError%2ConInfo%2ChideNotificationWidget%2CpostSharedMessage%2CsetNotificationWidgetHeight%2CswitchTo%2CnavigateTo%2CsetNotificationText%2CsetNotificationAnimation%2ChandlePosted%2C_ready%2C_close%2C_open%2C_resizeMe%2C_renderstart)
│  │    ├──0.31 MB (00.11%) ++ compartment([System Principal], jar:file:///D:/SSD2/Users/Main/AppData/Roaming/Mozilla/Firefox/Profiles/ytkmy7u6.default/extensions/elemhidehelper@adblockplus.org.xpi!/bootstrap.js, 0x881d000)
│  │    ├──0.24 MB (00.09%) ++ compartment(file:///d:/SSD2/Users/Main/Desktop/From%20Desktop/shippinglabel.asp.htm)
│  │    ├──0.11 MB (00.04%) ++ compartment(http://www.google.co.uk/reader/view/?hl=en&tab=wy)
│  │    ├──0.10 MB (00.04%) ++ compartment(https://plus.google.com/u/0/_/nonplus/error/?hl=en#pid=32&id=gbsf&parent=http%3A%2F%2Fwww.google.co.uk&rpctoken=865303782&_methods=onError%2ConInfo%2ChideNotificationWidget%2CpostSharedMessage%2CsetNotificationWidgetHeight%2CswitchTo%2CnavigateTo%2CsetNotificationText%2CsetNotificationAnimation%2ChandlePosted%2C_ready%2C_close%2C_open%2C_resizeMe%2C_renderstart)
│  │    ├──0.10 MB (00.04%) ++ compartment([System Principal], NoScript::ScriptSurrogate@about:memory, 0x997e000)
│  │    ├──0.09 MB (00.03%) ++ compartment(about:)
│  │    ├──0.03 MB (00.01%) ++ compartment(moz-nullprincipal:{4fedb5b1-cecd-4ce7-813c-306847b7b49e})
│  │    ├──0.00 MB (00.00%) ── gc-heap-chunk-dirty-unused
│  │    └──0.00 MB (00.00%) ── gc-heap-chunk-clean-unused
│  └────6.50 MB (02.32%) -- compartment(atoms)
│       ├──3.76 MB (01.34%) ── string-chars
│       └──2.74 MB (00.98%) ++ gc-heap
├───39.47 MB (14.12%) ── heap-unclassified
├───17.13 MB (06.13%) -- storage
│   ├──15.16 MB (05.43%) -- sqlite
│   │  ├───7.67 MB (02.74%) -- places.sqlite
│   │  │   ├──7.22 MB (02.58%) ── cache-used [4]
│   │  │   └──0.44 MB (00.16%) ++ (2 tiny)
│   │  └───7.50 MB (02.68%) ++ (11 tiny)
│   └───1.97 MB (00.70%) ++ prefixset
├────6.74 MB (02.41%) -- window-objects
│    ├──4.54 MB (01.63%) -- top(http://www.google.co.uk/reader/view/?hl=en&tab=wy#stream/feed%2Fhttp%3A%2F%2Fwww.engadget.com%2Frss.xml, id=283)
│    │  └──4.54 MB (01.63%) -- active
│    │     ├──3.28 MB (01.17%) ++ window(http://www.google.co.uk/reader/view/?hl=en&tab=wy#stream/feed%2Fhttp%3A%2F%2Fwww.engadget.com%2Frss.xml)
│    │     └──1.26 MB (00.45%) ++ (3 tiny)
│    └──2.19 MB (00.78%) ++ (4 tiny)
├────6.57 MB (02.35%) ++ (9 tiny)
└────3.01 MB (01.08%) ++ images

Other Measurements
  0.98 MB ── canvas-2d-pixel-bytes
279.46 MB ── explicit
  4.64 MB ── gfx-d2d-surfacecache
 10.98 MB ── gfx-d2d-surfacevram
  5.02 MB ── gfx-surface-image
        0 ── ghost-windows
134.63 MB ── heap-allocated
185.48 MB ── heap-committed
   27.41% ── heap-committed-fragmentation
  3.77 MB ── heap-dirty
269.37 MB ── heap-unallocated
  0.01 MB ── images-content-used-uncompressed
        4 ── js-compartments-system
        9 ── js-compartments-user
  0.29 MB ── js-main-runtime-analysis-temporary
111.62 MB ── js-main-runtime-gc-heap-allocated
 10.11 MB ── js-main-runtime-gc-heap-arena-unused
  0.00 MB ── js-main-runtime-gc-heap-chunk-clean-unused
  0.00 MB ── js-main-runtime-gc-heap-chunk-dirty-unused
121.73 MB ── js-main-runtime-gc-heap-committed
 20.27 MB ── js-main-runtime-gc-heap-decommitted
    0.23% ── js-main-runtime-gc-heap-fragmentation
 10.11 MB ── js-main-runtime-gc-heap-unused
  1.09 MB ── js-main-runtime-mjit
124.06 MB ── js-main-runtime-objects
  6.13 MB ── js-main-runtime-scripts
 12.51 MB ── js-main-runtime-shapes
 10.06 MB ── js-main-runtime-strings
  0.48 MB ── js-main-runtime-type-inference
        0 ── low-commit-space-events
        0 ── low-memory-events-physical
        0 ── low-memory-events-virtual
398.16 MB ── private
449.97 MB ── resident
  0.29 MB ── shmem-allocated
  0.29 MB ── shmem-mapped
 15.16 MB ── storage-sqlite
899.57 MB ── vsize
  0.88 MB ── window-objects-dom
  1.68 MB ── window-objects-layout-arenas
  3.09 MB ── window-objects-layout-style-sets
  0.00 MB ── window-objects-layout-text-runs
  1.08 MB ── window-objects-style-sheets



After entering and exiting private browsing:

Explicit Allocations
261.30 MB (100.0%) -- explicit
├──193.49 MB (74.05%) -- js
│  ├──147.77 MB (56.55%) -- compartment([System Principal], 0x7386000)
│  │  ├──110.18 MB (42.17%) -- gc-heap
│  │  │  ├───95.51 MB (36.55%) -- objects
│  │  │  │   ├──81.79 MB (31.30%) ── non-function
│  │  │  │   └──13.72 MB (05.25%) ── function
│  │  │  ├────6.54 MB (02.50%) -- arena
│  │  │  │    ├──6.01 MB (02.30%) ── unused
│  │  │  │    └──0.53 MB (00.20%) ++ (2 tiny)
│  │  │  ├────5.05 MB (01.93%) -- shapes
│  │  │  │    ├──2.70 MB (01.03%) ── dict
│  │  │  │    └──2.35 MB (00.90%) ++ (2 tiny)
│  │  │  └────3.09 MB (01.18%) ++ (4 tiny)
│  │  ├───28.98 MB (11.09%) -- objects
│  │  │   ├──26.55 MB (10.16%) ── slots
│  │  │   └───2.43 MB (00.93%) ++ (2 tiny)
│  │  ├────5.38 MB (02.06%) ++ (5 tiny)
│  │  └────3.24 MB (01.24%) ── script-data
│  ├───18.99 MB (07.27%) ── xpconnect
│  ├────8.16 MB (03.12%) ── gc-heap-decommitted
│  ├────6.49 MB (02.48%) -- compartment(atoms)
│  │    ├──3.77 MB (01.44%) ── string-chars
│  │    └──2.72 MB (01.04%) ++ gc-heap
│  ├────5.18 MB (01.98%) -- compartment(http://www.google.co.uk/reader/view/?hl=en&tab=wy#stream/feed%2Fhttp%3A%2F%2Fwww.engadget.com%2Frss.xml)
│  │    ├──2.87 MB (01.10%) ++ gc-heap
│  │    └──2.31 MB (00.88%) ++ (7 tiny)
│  ├────4.25 MB (01.62%) -- (10 tiny)
│  │    ├──1.98 MB (00.76%) ── gc-heap-chunk-admin
│  │    ├──1.35 MB (00.52%) ++ compartment(https://plus.google.com/u/0/_/nonplus/error/?hl=en#pid=32&id=gbsf&parent=http%3A%2F%2Fwww.google.co.uk&rpctoken=242624355&_methods=onError%2ConInfo%2ChideNotificationWidget%2CpostSharedMessage%2CsetNotificationWidgetHeight%2CswitchTo%2CnavigateTo%2CsetNotificationText%2CsetNotificationAnimation%2ChandlePosted%2C_ready%2C_close%2C_open%2C_resizeMe%2C_renderstart)
│  │    ├──0.44 MB (00.17%) ++ compartment([System Principal], jar:file:///D:/SSD2/Users/Main/AppData/Roaming/Mozilla/Firefox/Profiles/ytkmy7u6.default/extensions/elemhidehelper@adblockplus.org.xpi!/bootstrap.js, 0x881d000)
│  │    ├──0.24 MB (00.09%) ++ compartment(file:///d:/SSD2/Users/Main/Desktop/From%20Desktop/shippinglabel.asp.htm)
│  │    ├──0.10 MB (00.04%) ++ compartment([System Principal], NoScript::ScriptSurrogate@about:memory, 0x891c000)
│  │    ├──0.09 MB (00.04%) ++ compartment(about:)
│  │    ├──0.03 MB (00.01%) ++ compartment(moz-nullprincipal:{4fedb5b1-cecd-4ce7-813c-306847b7b49e})
│  │    ├──0.00 MB (00.00%) ++ compartment([System Principal], NoScript::ScriptSurrogate@about:memory, 0x7e6b000)
│  │    ├──0.00 MB (00.00%) ── gc-heap-chunk-dirty-unused
│  │    └──0.00 MB (00.00%) ── gc-heap-chunk-clean-unused
│  └────2.65 MB (01.01%) ++ runtime
├───36.12 MB (13.82%) ── heap-unclassified
├───17.20 MB (06.58%) -- storage
│   ├──15.23 MB (05.83%) -- sqlite
│   │  ├───7.73 MB (02.96%) -- places.sqlite
│   │  │   ├──7.28 MB (02.79%) ── cache-used [4]
│   │  │   └──0.44 MB (00.17%) ++ (2 tiny)
│   │  └───7.50 MB (02.87%) ++ (11 tiny)
│   └───1.97 MB (00.75%) ++ prefixset
├────8.05 MB (03.08%) ++ (10 tiny)
└────6.44 MB (02.46%) -- window-objects
     ├──4.36 MB (01.67%) -- top(http://www.google.co.uk/reader/view/?hl=en&tab=wy#stream/feed%2Fhttp%3A%2F%2Fwww.engadget.com%2Frss.xml, id=2037)
     │  └──4.36 MB (01.67%) -- active
     │     ├──3.10 MB (01.18%) ++ window(http://www.google.co.uk/reader/view/?hl=en&tab=wy#stream/feed%2Fhttp%3A%2F%2Fwww.engadget.com%2Frss.xml)
     │     └──1.26 MB (00.48%) ++ (2 tiny)
     └──2.08 MB (00.80%) ++ (4 tiny)

Other Measurements
  1.46 MB ── canvas-2d-pixel-bytes
261.30 MB ── explicit
  4.64 MB ── gfx-d2d-surfacecache
 11.25 MB ── gfx-d2d-surfacevram
  5.00 MB ── gfx-surface-image
        0 ── ghost-windows
131.53 MB ── heap-allocated
179.68 MB ── heap-committed
   26.79% ── heap-committed-fragmentation
  2.35 MB ── heap-dirty
273.47 MB ── heap-unallocated
  0.00 MB ── images-content-used-uncompressed
        5 ── js-compartments-system
        9 ── js-compartments-user
  0.66 MB ── js-main-runtime-analysis-temporary
110.49 MB ── js-main-runtime-gc-heap-allocated
  8.35 MB ── js-main-runtime-gc-heap-arena-unused
  0.00 MB ── js-main-runtime-gc-heap-chunk-clean-unused
  0.00 MB ── js-main-runtime-gc-heap-chunk-dirty-unused
118.84 MB ── js-main-runtime-gc-heap-committed
  8.16 MB ── js-main-runtime-gc-heap-decommitted
    0.13% ── js-main-runtime-gc-heap-fragmentation
  8.35 MB ── js-main-runtime-gc-heap-unused
  1.07 MB ── js-main-runtime-mjit
125.81 MB ── js-main-runtime-objects
  6.12 MB ── js-main-runtime-scripts
  8.28 MB ── js-main-runtime-shapes
 10.07 MB ── js-main-runtime-strings
  0.53 MB ── js-main-runtime-type-inference
        0 ── low-commit-space-events
        0 ── low-memory-events-physical
        0 ── low-memory-events-virtual
377.75 MB ── private
429.27 MB ── resident
  0.29 MB ── shmem-allocated
  0.29 MB ── shmem-mapped
 15.23 MB ── storage-sqlite
888.98 MB ── vsize
  0.73 MB ── window-objects-dom
  1.54 MB ── window-objects-layout-arenas
  3.09 MB ── window-objects-layout-style-sets
  0.00 MB ── window-objects-layout-text-runs
  1.08 MB ── window-objects-style-sheets
Comment 18 Andrew McCreight (PTO-ish through 6-29) [:mccr8] 2012-04-18 20:46:59 PDT
Ben has also seen a problem like this.  He said something like it is putting a listener on each page, and failing to remove it.  I forgot the specifics.
Comment 19 Philip Forget 2012-04-19 11:12:15 PDT
Jorge: Taking a look at it again today, had to set it aside for some other high priority issues. I released 2.2 which is really only a small change to sites we allow Readability to be run on. It will be up in the Mozilla store soon. 2.3 should be the release that addresses this issue, which I have a good idea of what it is now. Taking a crack at this now. Thanks everyone for chipping in on testing this
Comment 20 Ben Turner (not reading bugmail, use the needinfo flag!) 2012-04-30 13:42:24 PDT
Hi Philip,

I've seen several problems here:

1. key handlers are registered even when key handlers are disabled in the preferences.
2. key handlers are never removed.

Those are maybe not so bad, but should probably get fixed.

The big thing I have seen is bug 750454. Totally not your fault, but you make it exceptionally bad because of this:

  for(var window_index in Application.windows){
    if(Application.windows.hasOwnProperty(window_index)){
      var window = Application.windows[window_index];
      for(var tab_index in window.tabs){
        if(window.tabs.hasOwnProperty(tab_index)){
          var tab = window.tabs[tab_index]
  ...

Each call to "Application.windows" generates a *new* array containing all windows. Similarly, each call to "window.tabs" generates a *new* array containing all tabs. This is really slow, and makes bug 750454 especially bad.
Comment 21 Philip Forget 2012-05-01 12:53:10 PDT
Hello Ben,

Thanks for taking the time to look under the hood. When you mention that key handlers aren't being removed, wouldn't they be closed when the window containing the document they are attached to is closed?

As for the second issue, that code only ever gets called on a fresh install of the extension. I'll check to make sure that is the case, but just form reviewing the code now, it should ever only run once if ever.

Philip
Comment 22 Ben Turner (not reading bugmail, use the needinfo flag!) 2012-05-01 16:41:32 PDT
Hi Phillip,

I did some more digging, and yes, the key listeners will get automatically cleaned up. That isn't really your issue, sorry about that.

The real problem is bug 750454, though in a slightly different way than I thought (now filed as bug 750953).

You're correct that the large loop (comment 20) isn't really at fault here. Here's what I see happening.

At startup, rdb.firefox.overlay.init() happens for each window through the "load" event listener. Assuming normal non-upgrade, non-firstrun code path we have this code running:

  if(Application.windows[0].tabs[0].uri.spec == 'about:blank'){
    ...
  }

That should always return false, but the damage is basically done here. You create a whole bunch of FUEL Window/BrowserTab objects there. That matters in a sec.

Then, you have a content_loaded_handler function to catch other page loads. That handler runs this:

  if(rdb.extensions.url_is_local(Application.activeWindow.activeTab.uri.spec)){
    ...
  }

That creates a new Window and BrowserTab object every time a page loads (including things like iframes).

So basically you have a steadily (and, maybe, rapidly) growing number of FUEL Window objects (they never go away until shutdown). Each one of these registers a handler for events like "TabSelect", so for every FUEL Window you have a callback happen every time someone switches a tab, opens a tab, etc. And then, every time those callbacks happen each one ends up creating another BrowserTab object (those also stay alive until shutdown). So basically memory usage goes up and up and up. And then, at shutdown, we try to clean this up in a really bad way, leading to an n^2 shutdown (n == number of Window/BrowserTab objects).

We're going to fix this properly, because this is really bad, but in the meantime I think I can only recommend not using FUEL to make your addon. I would take a look at all the ways you use it (App.activeWindow.activeTab, App.windows[], etc) and unroll them manually based on what FUEL does here:

https://mxr.mozilla.org/mozilla-central/source/browser/fuel/src/fuelApplication.js

Sorry about that. This is lame.
Comment 23 Philip Forget 2012-05-02 10:56:09 PDT
Hey Ben,

I really do have to say thank you again for taking the time to look into this. I'm going to have a go at unwrapping those function calls now. Again, thank you!
Comment 24 Philip Forget 2012-05-08 06:26:38 PDT
Thanks everyone for their input on this. I cleaned up and unrolled where we were using Fuel API's and put out a new version. Your extension should update automatically but it's pending review in the mozilla store. For those who want to get it from us you can go to http://www.readability.com/addons and grab version 2.3 from there. Again, thanks everyone for looking into this, I really hope it resolves the issue.

Philip
Comment 25 Nicholas Nethercote [:njn] (on vacation until July 11) 2012-05-15 22:32:00 PDT
DB Cooper, can you (or anyone else) confirm that version 2.3 fixes the problem?  Thanks!
Comment 26 Ben Turner (not reading bugmail, use the needinfo flag!) 2012-05-15 22:33:26 PDT
I've been using it for about a week now and haven't seen anything unusual. I'll take a look at the changes if I can find some spare time in the near future but I think this is fixed.
Comment 27 Nicholas Nethercote [:njn] (on vacation until July 11) 2012-05-16 02:42:40 PDT
(In reply to ben turner [:bent] from comment #26)
> I've been using it for about a week now and haven't seen anything unusual.

Good enough for me.  Thanks.
Comment 28 Wayne Mery (:wsmwk, NI for questions) 2012-05-18 10:07:22 PDT
*** Bug 756261 has been marked as a duplicate of this bug. ***

Note You need to log in before you can comment on or make changes to this bug.