{"id":1687,"date":"2012-02-01T16:35:58","date_gmt":"2012-02-01T05:35:58","guid":{"rendered":"http:\/\/blog.mozilla.org\/nnethercote\/?p=1687"},"modified":"2012-02-01T16:35:58","modified_gmt":"2012-02-01T05:35:58","slug":"memshrink-progress-week-33","status":"publish","type":"post","link":"https:\/\/blog.mozilla.org\/nnethercote\/2012\/02\/01\/memshrink-progress-week-33\/","title":{"rendered":"MemShrink progress, week 33"},"content":{"rendered":"<h3>about:memory<\/h3>\n<p>Up until this week, about:memory was a static pages;\u00a0 once generated, it couldn&#8217;t change.\u00a0 This week, I landed a patch that <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=719335\">makes every sub-tree expandable and collapsible<\/a>.\u00a0 \u00a0 This can be quite useful, because it gives you fine control over what details to ignore. \u00a0The following screenshot shows an example where all the level 1 sub-trees in the &#8220;explicit&#8221; tree are collapsed except for &#8220;startup-cache&#8221;.\u00a0 (<code>++<\/code> indicates sub-trees that can be expanded, <code>--<\/code> indicates sub-trees that can be collapsed, and the remaining nodes (such as &#8220;heap-unclassified&#8221;) are leaf nodes).<\/p>\n<p><a><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-1688\" title=\"collapsed\" src=\"http:\/\/blog.mozilla.org\/nnethercote\/files\/2012\/02\/collapsed.png\" alt=\"a mostly-collapsed &quot;explicit&quot; tree in about:memory\" width=\"516\" height=\"351\" srcset=\"https:\/\/blog.mozilla.org\/nnethercote\/files\/2012\/02\/collapsed.png 516w, https:\/\/blog.mozilla.org\/nnethercote\/files\/2012\/02\/collapsed-300x204.png 300w\" sizes=\"(max-width: 516px) 100vw, 516px\" \/><\/a><\/p>\n<p>I also changed about:memory so that <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=698930\">obviously bogus values (e.g. negative values, percentages greater than 100%) are highlighted<\/a>.\u00a0 These indicate bugs in memory reporters, and so we want to know about them.<\/p>\n<h3>Memory Reporters<\/h3>\n<p>I added new <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=671299\">memory reporters for style sheets<\/a>.\u00a0 This was the single biggest remaining chunk of dark matter.\u00a0 On a 64-bit Linux build, this reduces the &#8220;heap-unclassified&#8221; count when I have Gmail and TechCrunch open from ~23% to ~15%.\u00a0 The counts mostly show up under the &#8220;explicit\/dom+style&#8221; sub-tree, in &#8220;style-sheets&#8221; leaf nodes.<\/p>\n<p>I also simplified the writing of memory reporters by <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=715453\">removing the need for the <code>computedSize<\/code> argument when measuring the size of a heap block<\/a>.<\/p>\n<p>Finally, if you create a sandbox with <code>Components.utils.Sandbox<\/code>, you can specify a name and about:memory will use that name to identify the sandbox&#8217;s compartment.\u00a0 Sander van Veen made it so that <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=681556\">sandboxes that aren&#8217;t given a name will use the\u00a0 their callers&#8217; filename as a name<\/a>.\u00a0 In other words, all sandboxes should now be identifiable in about:memory.<\/p>\n<h3>leaks<\/h3>\n<p>Brian Hackett fixed a <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=720359\">leak in JaegerMonkey<\/a>.<\/p>\n<p>Andrew McCreight fixed a <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=693527\">leak caused by watchpoints<\/a>, which are used when debugging JavaScript code.<\/p>\n<p>A <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=716115\">leak related to JavaScript sharps<\/a> (a non-standard, SpiderMonkey-only feature) was fixed by Jeff Walden when he <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=566700\">removed support for sharps<\/a> \ud83d\ude42<\/p>\n<h3>Add-ons<\/h3>\n<p>I mentioned last week that I think leaky add-ons are the #1 problem for Firefox&#8217;s memory consumption, and mentioned the idea of telling users when they have an add-on installed that is known to have performance problems.\u00a0 <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=720856\">Bug 720856<\/a> is open for this.\u00a0 Asa Dotzler, Firefox Product Manager, <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=720856#c14\">said<\/a>:<\/p>\n<blockquote>\n<p id=\"comment_text_14\">I will secure Firefox client developer resources for this feature where I have some input into resourcing. If this plan is deemed appropriate, I will work with Justin to secure AMO side resources as well and we can nail this problem.<\/p>\n<p>We can&#8217;t keep going back and forth on this while our users suffer. We must act now. I understand that defining &#8220;bad add-ons&#8221; will be contentious but so long as the technical approach is righteous we can sort out how heavy handed we want to be on policy at a later time and move forward implementing this today.<\/p><\/blockquote>\n<p>There was already a <a href=\"https:\/\/wiki.mozilla.org\/Firefox\/Features\/Expose_Add-on_Performance\">feature page<\/a> covering this basic idea, and Asa updated it. This feature would be a huge help to users.\u00a0 Fingers crossed we&#8217;ll see some progress soon!<\/p>\n<p>Henrik Skupin has started working on an add-on called <a href=\"https:\/\/wiki.mozilla.org\/QA\/Automation_Services\/Projects\/Addons\/MemChaser\">MemChaser<\/a> (download it <a href=\"https:\/\/github.com\/whimboo\/memchaser\/downloads\">here<\/a>) which is aimed at helping detect problems relating to memory consumption.\u00a0 Currently it just shows some stats in the add-on bar &#8212; resident memory consumption (updated every two seconds), how long the last garbage collection took, and how long the last cycle collection took &#8212; but Henrik has <a href=\"https:\/\/wiki.mozilla.org\/QA\/Automation_Services\/Projects\/Addons\/MemChaser\/Future_Features\">many<\/a> <a href=\"https:\/\/etherpad.mozilla.org\/qas-addons-memchaser\">ideas <\/a>for the future.\u00a0 Worth watching!<\/p>\n<h3>Bug Counts<\/h3>\n<p>Here are this week\u2019s bug counts.<\/p>\n<ul>\n<li>P1: 22 (-0\/+2)<\/li>\n<li>P2: 130 (-3\/+2)<\/li>\n<li>P3: 74 (-2\/+2)<\/li>\n<li>Unprioritized: 3 (-4\/+3)<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>about:memory Up until this week, about:memory was a static pages;\u00a0 once generated, it couldn&#8217;t change.\u00a0 This week, I landed a patch that makes every sub-tree expandable and collapsible.\u00a0 \u00a0 This can be quite useful, because it gives you fine control over what details to ignore. \u00a0The following screenshot shows an example where all the level [&hellip;]<\/p>\n","protected":false},"author":139,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4550,119,30,4544,4546],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.mozilla.org\/nnethercote\/wp-json\/wp\/v2\/posts\/1687"}],"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=1687"}],"version-history":[{"count":0,"href":"https:\/\/blog.mozilla.org\/nnethercote\/wp-json\/wp\/v2\/posts\/1687\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.mozilla.org\/nnethercote\/wp-json\/wp\/v2\/media?parent=1687"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.mozilla.org\/nnethercote\/wp-json\/wp\/v2\/categories?post=1687"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.mozilla.org\/nnethercote\/wp-json\/wp\/v2\/tags?post=1687"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}