UISync.prototype.listeners leaks inProcessTabChildGlobal

Bug reports and enhancement requests
Post Reply
dorando
Posts: 2
Joined: Sun Nov 23, 2014 12:51 pm

UISync.prototype.listeners leaks inProcessTabChildGlobal

Post 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.
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:56.0) Gecko/20100101 Firefox/56.0
User avatar
therube
Ambassador
Posts: 7972
Joined: Thu Mar 19, 2009 4:17 pm
Location: Maryland USA

Re: UISync.prototype.listeners leaks inProcessTabChildGlobal

Post by therube »

e10s enabled?
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.19) Gecko/20110420 SeaMonkey/2.0.14 Pinball NoScript FlashGot AdblockPlus
Mozilla/5.0 (Windows NT 5.1; rv:52.0) Gecko/20100101 SeaMonkey/2.49.1
User avatar
Giorgio Maone
Site Admin
Posts: 9528
Joined: Wed Mar 18, 2009 11:22 pm
Location: Palermo - Italy
Contact:

Re: UISync.prototype.listeners leaks inProcessTabChildGlobal

Post by Giorgio Maone »

Patch accepted in latest development build 5.1.5rc2, thank you!
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:56.0) Gecko/20100101 Firefox/56.0
Post Reply