Page 1 of 1

UISync.prototype.listeners leaks inProcessTabChildGlobal

Posted: Mon Nov 06, 2017 3:20 pm
by dorando
fx56.0.2 fresh profile with:
NoScript 5.1.4
devtools.chrome.enabled;true

Open a new tab with about:memory, Minimize memory usage

Code: Select all

300 (100.0%) -- js-main-runtime-compartments
├──292 (97.33%) -- system
│  ├────3 (01.00%) ── [System Principal], inProcessTabChildGlobal?ownedBy=chrome://browser/content/browser.xul [3]
Open 10 Tabs, close them, Minimize memory usage

Code: Select all

│  ├───13 (04.05%) ── [System Principal], inProcessTabChildGlobal?ownedBy=chrome://browser/content/browser.xul [13]
Open 10 Tabs, close them, Minimize memory usage

Code: Select all

│  ├───23 (06.71%) ── [System Principal], inProcessTabChildGlobal?ownedBy=chrome://browser/content/browser.xul [23]
Run in Browser Console

Code: Select all

Components.utils.import("chrome://noscript/content/importer.jsm");
IMPORT_FOR(this)("UISync");
UISync.prototype.listeners.length = 0;
Minimize memory usage

Code: Select all

│  ├────2 (00.62%) ── [System Principal], inProcessTabChildGlobal?ownedBy=chrome://browser/content/browser.xul [2]
UISync.prototype.listeners is the same for all instances, but holds references to functions created in a different scope, proposed patch

Code: Select all

--- chrome/content/noscript/UISync.jsm	5.1.4
+++ chrome/content/noscript/UISync.jsm
@@ -11,6 +11,7 @@
 
 function UISync(ctx) {
   this.ctx = ctx;
+  this.listeners = [];
   this.wire();
   this.scheduleSync();
 }
@@ -21,7 +22,6 @@
     delKey: false,
   },
 
-  listeners: [],
   addListener(type, handler, ...opts) {
     this.ctx.addEventListener(type, handler, ...opts);
     this.listeners.push({type, handler, opts});
Notes:
outOfProcessTabChildGlobal are also leaked
If the Firefox Feature "Follow-on Search Telemetry" is enabled (default), chrome documents will also leak.

Re: UISync.prototype.listeners leaks inProcessTabChildGlobal

Posted: Mon Nov 06, 2017 3:52 pm
by therube
e10s enabled?

Re: UISync.prototype.listeners leaks inProcessTabChildGlobal

Posted: Tue Nov 07, 2017 1:13 am
by Giorgio Maone
Patch accepted in latest development build 5.1.5rc2, thank you!