{"id":2534,"date":"2013-03-20T16:19:29","date_gmt":"2013-03-20T05:19:29","guid":{"rendered":"http:\/\/blog.mozilla.org\/nnethercote\/?p=2534"},"modified":"2013-03-20T16:19:29","modified_gmt":"2013-03-20T05:19:29","slug":"memshrink-progress-week-91-92","status":"publish","type":"post","link":"https:\/\/blog.mozilla.org\/nnethercote\/2013\/03\/20\/memshrink-progress-week-91-92\/","title":{"rendered":"MemShrink progress, week 91&#8211;92"},"content":{"rendered":"<p>Bill McCloskey landed <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=759585\">zones<\/a>, a.k.a. compartment groups.\u00a0 This mitigates the overhead of each compartment by allowing all compartments within a zone to share arenas and strings.\u00a0 Roughly speaking, each tab gets its own zone, and there&#8217;s a system zone for Firefox&#8217;s internal use.\u00a0 This was a MemShrink:P1 bug.<\/p>\n<p>The following graph from areweslimyet.com shows the impact of zones &#8212; about 5\/6 of the way along the graph there&#8217;s a distinct drop, most noticeable in the dark blue line.\u00a0 The light green line (settled start-up) showed a ~6 MiB drop, which is ~10%.\u00a0 Note that the fraction of JS memory in areweslimyet.com is less than that in typical sites, so the drop in the higher lines is smaller than the improvements normal users should see.<\/p>\n<p><a href=\"http:\/\/blog.mozilla.org\/nnethercote\/files\/2013\/03\/awsy.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-2535\" alt=\"areweslimyet.com graph showing improvements due to zones\" src=\"http:\/\/blog.mozilla.org\/nnethercote\/files\/2013\/03\/awsy.png\" width=\"1289\" height=\"772\" srcset=\"https:\/\/blog.mozilla.org\/nnethercote\/files\/2013\/03\/awsy.png 1289w, https:\/\/blog.mozilla.org\/nnethercote\/files\/2013\/03\/awsy-300x179.png 300w, https:\/\/blog.mozilla.org\/nnethercote\/files\/2013\/03\/awsy-1024x613.png 1024w\" sizes=\"(max-width: 1289px) 100vw, 1289px\" \/><\/a><\/p>\n<p>Avi Halachmi <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=837542\">fixed a problem where badly managed gradients could cause spikes of 10s of MiBs when tab animations occurred<\/a>.\u00a0 This was a MemShrink:P1 bug.\u00a0 The fix has been backported to Aurora.<\/p>\n<p>Jed Parsons <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=839500\">fixed excessive memory consumption by Persona after visiting the B2G marketplace<\/a>.\u00a0 At least, I think that&#8217;s what happened;\u00a0 I won&#8217;t pretend to genuinely understand what went on in that bug.\u00a0 This was a MemShrink:P1 bug.<\/p>\n<p>Fabrice Desr\u00e9 <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=848615\">fixed a bad B2G leak relating to error messages<\/a>.\u00a0 This bug was fixed before it was triaged in a MemShrink meeting, but it probably would have been a MemShrink:P1 because it could cause the phone to OOM after a few hours.<\/p>\n<p>I <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=847248\">removed all uses of nsFixedSizeAllocator<\/a>.\u00a0 This was only a small memory consumption win (a few 10s of KiBs) but it cut several hundred lines of code, and removed another low-quality custom allocator (and <a href=\"http:\/\/en.wikipedia.org\/wiki\/Attractive_nuisance_doctrine\">attractive nuisance<\/a>) from the codebase.<\/p>\n<p>I added a &#8220;js-main-runtime-temporary-peak&#8221; memory reporter, which measures the peak size of the main JSRuntime&#8217;s &#8220;temporary&#8221; pool, which mostly holds parse nodes.\u00a0 These are short-lived but they can be quite large &#8212; 10s of MiBs in normal browsing, and we&#8217;ve seen it exceed 1.5 GiB on large asm.js examples.\u00a0 Relatedly, I <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=747831\">reduced the size of parse nodes<\/a> by 12.5% on 64-bit platforms, and 16.7% on 32-bit platforms.<\/p>\n<h3>Interesting Open Bugs<\/h3>\n<p>Sometimes, especially on B2G, we have excessive memory consumption due to JS strings.\u00a0 It would be useful to be able to dump the contents of all the strings in memory, to look for ones that shouldn&#8217;t be there.\u00a0 <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=852010\">Bug 852010<\/a> has been filed for this.\u00a0 It shouldn&#8217;t be too hard, as it would fit in with the existing JSON memory report dumping infrastructure.\u00a0 This is currently blocking <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=850893\">bug 850893<\/a>, a B2G MemShrink:P1 bug.\u00a0 Please comment in the bug or contact me if you want to get involved.<\/p>\n<p><a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=846616\">Bug 846616<\/a> and <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=850545\">bug 850545<\/a> both are about high &#8220;heap-unclassified&#8221; values.\u00a0 Reducing &#8220;heap-unclassified&#8221; is getting very difficult, because the memory is often allocated in ways we can&#8217;t measure by third-party code such as Cairo and graphics drivers.\u00a0 I suppose in the Cairo case we could put effort into adding some memory profiling infrastructure and try to get it upstreamed, but the driver situation seems pretty hopeless.<\/p>\n<h3>Bug Status<\/h3>\n<p>Here are the current bug counts.<\/p>\n<ul>\n<li>P1: 13 (-3\/+4)<\/li>\n<li>P2: 134 (-2\/+8)<\/li>\n<li>P3: 124 (-4\/+6)<\/li>\n<li>Unprioritized: 4 (-6\/+4)<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Bill McCloskey landed zones, a.k.a. compartment groups.\u00a0 This mitigates the overhead of each compartment by allowing all compartments within a zone to share arenas and strings.\u00a0 Roughly speaking, each tab gets its own zone, and there&#8217;s a system zone for Firefox&#8217;s internal use.\u00a0 This was a MemShrink:P1 bug. The following graph from areweslimyet.com shows the [&hellip;]<\/p>\n","protected":false},"author":139,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4261,30,4544,4546],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.mozilla.org\/nnethercote\/wp-json\/wp\/v2\/posts\/2534"}],"collection":[{"href":"https:\/\/blog.mozilla.org\/nnethercote\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.mozilla.org\/nnethercote\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.mozilla.org\/nnethercote\/wp-json\/wp\/v2\/users\/139"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.mozilla.org\/nnethercote\/wp-json\/wp\/v2\/comments?post=2534"}],"version-history":[{"count":0,"href":"https:\/\/blog.mozilla.org\/nnethercote\/wp-json\/wp\/v2\/posts\/2534\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.mozilla.org\/nnethercote\/wp-json\/wp\/v2\/media?parent=2534"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.mozilla.org\/nnethercote\/wp-json\/wp\/v2\/categories?post=2534"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.mozilla.org\/nnethercote\/wp-json\/wp\/v2\/tags?post=2534"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}