Some comments on this whole thread: - I'm very sympathetic to Justin's concerns. 120 MiB is not much memory. While it's (somewhat) ok to kill apps that are using too much memory, that doesn't work with the main B2G process, and I've been CC'd on enough "the B2G main process is using too much memory" bugs to understand this is an ongoing problem.
- Given the intense time pressure the B2G folks are under, saying things like "there's no fundamental reason why JS can't be memory-efficient" isn't much help when it currently isn't memory-efficient. - Justin knows more about B2G memory consumption than anyone; he's been looking at it closely for months. - Look at the data -- code size is not the issue for JS code. - Generational GC's timeline isn't even remotely feasible for B2G. B2G branched on version 18! Gen GC might be done in a few months. (Which is fair enough; Gen GC is a gigantic project.) - I believe Justin identified off-list that the workers (and probably the main JS runtime) are screaming out for more aggressive decommitting of the JS heap: >> 2.38 MB (05.13%) -- worker(resource://gre/modules/wifi_worker.js, 0x45584800) >> ├──1.77 MB (03.81%) -- gc-heap >> │ ├──1.74 MB (03.74%) ── unused-arenas "unused-arenas" are empty 4 KiB JS heap arenas that could be decommitted. The merged.json data shows almost 5 MiB worth of unused-arenas in 3 of the 4 workers. https://bugzilla.mozilla.org/show_bug.cgi?id=829482 is currently open on this issue. That sounds easier to fix than rewriting modules in C++. - Looking at the merged.json data: the system principal compartment merging is happening on the main process, but doesn't appear to be happening on all the other processes: Homescreen, Usage, (Preallocated app). I've included the relevant data below. Nick Homescreen (pid 390) Explicit Allocations 13,642,508 B (100.0%) -- explicit ├───4,403,684 B (32.28%) -- js-non-window │ ├──3,865,124 B (28.33%) -- compartments │ │ ├──3,358,912 B (24.62%) -- non-window-global │ │ │ ├────277,688 B (02.04%) ++ compartment([System Principal]) │ │ │ ├────262,212 B (01.92%) ++ compartment([System Principal], resource://gre/modules/DOMRequestHelper.jsm) │ │ │ ├────199,328 B (01.46%) ++ compartment([System Principal], jar:file:///system/b2g/omni.ja!/components/Webapps.js) │ │ │ ├────187,400 B (01.37%) ++ compartment([System Principal], resource://gre/modules/XPCOMUtils.jsm) │ │ │ ├────182,632 B (01.34%) ++ compartment([System Principal], resource://gre/modules/CSPUtils.jsm) │ │ │ ├────134,456 B (00.99%) ++ compartment([System Principal], resource://gre/modules/ObjectWrapper.jsm) │ │ │ ├────124,216 B (00.91%) ++ compartment([System Principal], jar:file:///system/b2g/omni.ja!/components/SettingsManager.js) │ │ │ ├────114,360 B (00.84%) ++ compartment([System Principal], resource://gre/modules/UserAgentOverrides.jsm) │ │ │ ├────110,008 B (00.81%) ++ compartment([System Principal], jar:file:///system/b2g/omni.ja!/components/contentSecurityPolicy.js) │ │ │ ├────107,012 B (00.78%) ++ compartment([System Principal], resource://gre/modules/AppsServiceChild.jsm) │ │ │ ├────105,264 B (00.77%) ++ compartment([System Principal], jar:file:///system/b2g/omni.ja!/components/PushService.js) │ │ │ ├────104,688 B (00.77%) ++ compartment([System Principal], jar:file:///system/b2g/omni.ja!/components/DirectoryProvider.js) │ │ │ ├─────98,664 B (00.72%) ++ compartment([System Principal], jar:file:///system/b2g/omni.ja!/components/nsHandlerService.js) │ │ │ ├─────92,656 B (00.68%) ++ compartment([System Principal], jar:file:///system/b2g/omni.ja!/components/nsPrompter.js) │ │ │ ├─────89,624 B (00.66%) ++ compartment([System Principal], resource://gre/modules/BrowserElementPromptService.jsm) │ │ │ ├─────83,176 B (00.61%) ++ compartment([System Principal], resource://gre/modules/AppsUtils.jsm) │ │ │ ├─────82,712 B (00.61%) ++ compartment([System Principal], resource://gre/modules/services-common/preferences.js) │ │ │ ├─────81,536 B (00.60%) ++ compartment([System Principal], resource://gre/modules/BrowserElementParent.jsm) │ │ │ ├─────77,520 B (00.57%) ++ compartment([System Principal], jar:file:///system/b2g/omni.ja!/components/AppProtocolHandler.js) │ │ │ ├─────70,168 B (00.51%) ++ compartment([System Principal], resource://gre/modules/Geometry.jsm) │ │ │ ├─────69,648 B (00.51%) ++ compartment([System Principal], resource://gre/modules/SettingsDB.jsm) │ │ │ ├─────66,392 B (00.49%) ++ compartment([System Principal], resource://gre/modules/NetUtil.jsm) │ │ │ ├─────65,768 B (00.48%) ++ compartment([System Principal], resource://gre/modules/Services.jsm) │ │ │ ├─────65,112 B (00.48%) ++ compartment([System Principal], resource://gre/modules/commonjs/promise/core.js) │ │ │ ├─────64,880 B (00.48%) ++ compartment([System Principal], jar:file:///system/b2g/omni.ja!/components/BrowserElementParent.js) │ │ │ ├─────64,864 B (00.48%) ++ compartment([System Principal], jar:file:///system/b2g/omni.ja!/components/AppsService.js) │ │ │ ├─────64,424 B (00.47%) ++ compartment([System Principal], jar:file:///system/b2g/omni.ja!/components/ProcessGlobal.js) │ │ │ ├─────63,656 B (00.47%) ++ compartment([System Principal], jar:file:///system/b2g/omni.ja!/components/nsIDService.js) │ │ │ ├─────60,472 B (00.44%) ++ compartment([System Principal], resource://gre/modules/IndexedDBHelper.jsm) │ │ │ ├─────60,408 B (00.44%) ++ compartment([System Principal], resource://gre/modules/FileUtils.jsm) │ │ │ ├─────58,360 B (00.43%) ++ compartment([System Principal], resource://gre/modules/SettingsQueue.jsm) │ │ │ ├─────43,560 B (00.32%) ++ compartment(moz-nullprincipal:{0cf61a20-96af-456a-ba29-ca139251bdd6}) │ │ │ └─────26,048 B (00.19%) ++ compartment(null-principal) _______________________________________________ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform