UISync.prototype.listeners leaks inProcessTabChildGlobal
Posted: Mon Nov 06, 2017 3:20 pm
fx56.0.2 fresh profile with:
NoScript 5.1.4
devtools.chrome.enabled;true
Open a new tab with about:memory, Minimize memory usageOpen 10 Tabs, close them, Minimize memory usageOpen 10 Tabs, close them, Minimize memory usageRun in Browser ConsoleMinimize memory usage
UISync.prototype.listeners is the same for all instances, but holds references to functions created in a different scope, proposed patch
Notes:
outOfProcessTabChildGlobal are also leaked
If the Firefox Feature "Follow-on Search Telemetry" is enabled (default), chrome documents will also leak.
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]
Code: Select all
│ ├───13 (04.05%) ── [System Principal], inProcessTabChildGlobal?ownedBy=chrome://browser/content/browser.xul [13]Code: Select all
│ ├───23 (06.71%) ── [System Principal], inProcessTabChildGlobal?ownedBy=chrome://browser/content/browser.xul [23]Code: Select all
Components.utils.import("chrome://noscript/content/importer.jsm");
IMPORT_FOR(this)("UISync");
UISync.prototype.listeners.length = 0;Code: Select all
│ ├────2 (00.62%) ── [System Principal], inProcessTabChildGlobal?ownedBy=chrome://browser/content/browser.xul [2]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});outOfProcessTabChildGlobal are also leaked
If the Firefox Feature "Follow-on Search Telemetry" is enabled (default), chrome documents will also leak.