{"id":1946,"date":"2012-05-30T17:18:17","date_gmt":"2012-05-30T06:18:17","guid":{"rendered":"http:\/\/blog.mozilla.org\/nnethercote\/?p=1946"},"modified":"2012-05-31T11:40:15","modified_gmt":"2012-05-31T00:40:15","slug":"memshrink-progress-week-49-50","status":"publish","type":"post","link":"https:\/\/blog.mozilla.org\/nnethercote\/2012\/05\/30\/memshrink-progress-week-49-50\/","title":{"rendered":"MemShrink progress, week 49-50"},"content":{"rendered":"<h3>System Compartment Reporting<\/h3>\n<p>With the recent landing of compartment-per-global, Firefox now regularly has 200+ system compartments at start-up.\u00a0 However, most of these compartments didn&#8217;t have names, which meant that they were merged into a single &#8220;[System Principal]&#8221; entry in about:memory and about:compartments.<\/p>\n<p>Until last week, that is, when Nils Maier <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=754771\">added identifying information to the vast majority of these<\/a>.\u00a0 Here&#8217;s a small selection of interesting ones from about:compartments on my own machine.<\/p>\n<pre>about:blank\r\nabout:compartments\r\nabout:memory?verbose\r\n\r\nchrome:\/\/adblockplus-modules\/content\/FilterClasses.jsm\r\n\r\nchrome:\/\/browser\/content\/bookmarks\/bookmarksPanel.xul\r\nchrome:\/\/browser\/content\/browser.xul\r\nchrome:\/\/browser\/content\/places\/menu.xml\r\nchrome:\/\/browser\/content\/search\/search.xml\r\n\r\nchrome:\/\/chatzilla\/content\/browserOverlay.xul\r\n\r\nchrome:\/\/global\/content\/bindings\/button.xml\r\nchrome:\/\/global\/content\/globalOverlay.xul\r\n\r\nchrome:\/\/treestyletab\/content\/treestyletab.xul\r\n\r\nfile:\/\/\/home\/njn\/moz\/mi0\/o64\/dist\/bin\/components\/TelemetryPing.js\r\n\r\njar:file:\/\/\/home\/njn\/moz\/mi0\/o64\/dist\/bin\/extensions\/uriloader@pdf.js.xpi!\/bootstrap.js\r\njar:file:\/\/\/home\/njn\/moz\/mi0\/o64\/dist\/bin\/extensions\/uriloader@pdf.js.xpi!\/components\/PdfStreamConverter.js\r\n\r\nresource:\/\/\/modules\/TelemetryTimestamps.jsm\r\nresource:\/\/\/modules\/sessionstore\/DocumentUtils.jsm\r\n\r\nresource:\/\/gre-resources\/hiddenWindow.html\r\n\r\nresource:\/\/gre\/modules\/AddonManager.jsm\r\n\r\nresource:\/\/services-common\/preferences.js\r\nresource:\/\/services-crypto\/WeaveCrypto.js\r\nresource:\/\/services-sync\/constants.js\r\nresource:\/\/services-sync\/engines\/bookmarks.js\r\n\r\nresource:\/\/treestyletab-modules\/browser.js\r\nresource:\/\/treestyletab-modules\/lib\/animationManager.js<\/pre>\n<p>Just from this, it&#8217;s obvious that I had about:compartments and about:memory?verbose open at the time.\u00a0 It&#8217;s also obvious that I had the following add-ons installed:\u00a0 AdBlock Plus, Chatzilla, Tree Style Tab, and pdf.js.\u00a0 And about:memory now gives at least a partial measurement of how much memory these add-ons are using.\u00a0 This will help identify add-ons that are using excessive amounts of memory.\u00a0 (Having said that, I identified the add-on compartments simply by their names.\u00a0 It&#8217;d be great if there was a way to systematically identify them within the code, but I don&#8217;t know if that&#8217;s possible.)<\/p>\n<p>I also hope people will scrutinize Firefox&#8217;s own compartment use closely, and start to file bug reports saying things like &#8220;hey, that .jsm module shouldn&#8217;t be present, there must be a leak&#8221;.\u00a0 If you want to see what the full list of 200+ looks like, try out a recent Nightly build!<\/p>\n<p>In related news, I also <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=755581\">added some new compartment-specific reports<\/a>, including ones for cross-compartment wrappers.<\/p>\n<p>One consequence of all these change is that the number of entries in about:memory jumped tremendously.\u00a0 As a result, <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=755583\">I aggregated the small entries within each compartment<\/a>, which reduces the number of entries by a factor of roughly four while still reporting full information for large compartments.\u00a0 Nils and I also <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=755992\">made about:memory<\/a> <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=757299\">more efficient<\/a>, so the amount of memory required to generate each line dropped by about 20%.\u00a0 about:memory still takes up memory itself, but it does so at a level that I&#8217;m fairly happy with.<\/p>\n<h3>Add-ons<\/h3>\n<p>For a change, the biggest MemShrink-related news in this report wasn&#8217;t related to add-ons!\u00a0 But there was still some interesting movement there.<\/p>\n<p>Justin Lebar uncovered some evidence that the <a href=\"http:\/\/blog.kylehuey.com\/post\/21892343371\/fixing-the-memory-leak\">Hueyfix<\/a> is having a real, positive effect among users.\u00a0 Telemetry data from Nightly users shows that the number of ghost windows &#8212; a concept for which we don&#8217;t have good documentation, but they correlate with zombie compartments &#8212; has dropped dramatically, as the following graph shows.<\/p>\n<p><a href=\"http:\/\/blog.mozilla.org\/nnethercote\/files\/2012\/05\/ghost-windows.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-1948\" title=\"ghost-windows\" src=\"http:\/\/blog.mozilla.org\/nnethercote\/files\/2012\/05\/ghost-windows.png\" alt=\"ghost windows telemetry data graph\" width=\"981\" height=\"715\" srcset=\"https:\/\/blog.mozilla.org\/nnethercote\/files\/2012\/05\/ghost-windows.png 981w, https:\/\/blog.mozilla.org\/nnethercote\/files\/2012\/05\/ghost-windows-300x218.png 300w\" sizes=\"(max-width: 981px) 100vw, 981px\" \/><\/a><\/p>\n<p>Telemetry data tends to be extremely noisy, so it&#8217;s nice to see a clear signal &#8212; Kyle&#8217;s change made it into Nightly builds on May 5th [<strong>Update:<\/strong> that&#8217;s incorrect, see below] and immediately caused the mean number of ghost windows to drop from roughly three to roughly one.\u00a0 The variance also dropped dramatically.<\/p>\n<p><strong>Update:<\/strong> Justin just wrote a <a href=\"http:\/\/jlebar.com\/2012\/5\/30\/A_ghost_story.html\">blog post<\/a> that explains very nicely what ghost windows are.\u00a0 That post also explains better the circumstances behind the drop in ghost window numbers;\u00a0 my explanation above was too simple and got the timing wrong.\u00a0 Thanks, Justin!<\/p>\n<p>In other add-on news, the following add-ons had leaks fixed: <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=730546\">Readability<\/a>, <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=732374\">ProxTube<\/a>, Youtube MP3 Podcaster.<\/p>\n<h3>Firefox vs The New York Times<\/h3>\n<p>Robert O&#8217;Callahan fixed <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=757807\">a leak relating to mouse events<\/a> that triggered when he visited nytimes.com.\u00a0 He wrote\u00a0<a href=\"http:\/\/robert.ocallahan.org\/2012\/05\/firefox-vs-new-york-times.html\">a great blog post<\/a> explaining the heroic debugging &#8212; searching through full memory dumps! &#8212; that was required.\u00a0 It&#8217;s great that Robert found and fixed this, though it&#8217;s a shame it took such expertise.<\/p>\n<h3>Bug Counts<\/h3>\n<p>Here are the current bug counts.<\/p>\n<ul>\n<li>P1: 23 (-1\/+2)<\/li>\n<li>P2: 85 (-2\/+4)<\/li>\n<li>P3: 102 (-5\/+2)<\/li>\n<li>Unprioritized: 2 (-3\/+2)<\/li>\n<\/ul>\n<p>Not a great deal of movement.\u00a0 We only had to triage twelve bugs in today&#8217;s MemShrink meeting, which is the fewest we&#8217;ve had since we switched to fortnightly meetings.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>System Compartment Reporting With the recent landing of compartment-per-global, Firefox now regularly has 200+ system compartments at start-up.\u00a0 However, most of these compartments didn&#8217;t have names, which meant that they were merged into a single &#8220;[System Principal]&#8221; entry in about:memory and about:compartments. Until last week, that is, when Nils Maier added identifying information to the [&hellip;]<\/p>\n","protected":false},"author":139,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[15267,4550,4559,119,4554,30,4544,4546],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.mozilla.org\/nnethercote\/wp-json\/wp\/v2\/posts\/1946"}],"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=1946"}],"version-history":[{"count":0,"href":"https:\/\/blog.mozilla.org\/nnethercote\/wp-json\/wp\/v2\/posts\/1946\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.mozilla.org\/nnethercote\/wp-json\/wp\/v2\/media?parent=1946"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.mozilla.org\/nnethercote\/wp-json\/wp\/v2\/categories?post=1946"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.mozilla.org\/nnethercote\/wp-json\/wp\/v2\/tags?post=1946"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}