{"id":1782,"date":"2012-02-22T13:36:36","date_gmt":"2012-02-22T02:36:36","guid":{"rendered":"http:\/\/blog.mozilla.org\/nnethercote\/?p=1782"},"modified":"2012-02-22T13:36:36","modified_gmt":"2012-02-22T02:36:36","slug":"memshrink-progress-week-36","status":"publish","type":"post","link":"https:\/\/blog.mozilla.org\/nnethercote\/2012\/02\/22\/memshrink-progress-week-36\/","title":{"rendered":"MemShrink progress, week 36"},"content":{"rendered":"<p>Lots of activity this week.<\/p>\n<h3>Leaky add-ons<\/h3>\n<p>I created a new devmo wiki page documenting <a href=\"https:\/\/developer.mozilla.org\/en\/Extensions\/Common_causes_of_memory_leaks_in_extensions\">common causes of memory leaks in add-ons<\/a>.\u00a0 I based this on a <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=725194\">lovely selection of examples<\/a> provided by Nils Maier.\u00a0 Unfortunately, I know almost nothing about writing add-ons and so I&#8217;m not happy with the current state of the documentation.\u00a0 I&#8217;ve taken it as far as I can, but it very likely has errors, leaves out important cases, conflates distinct concepts, and generally is not as good as it should be.\u00a0 This documentation is <em>really<\/em> important &#8212; we have good tools for identifying when add-on leaks occur but we don&#8217;t yet have good tools for identifying their causes.\u00a0 Until we have those tools, documentation is the only way we can help add-on authors fix leaks.\u00a0 If someone who knows more about add-ons is willing to help please contact me!<\/p>\n<p>Alexandre Poirot <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=724404\">fixed a leak in the Add-on SDK<\/a> that was causing zombie compartments when certain add-ons were disabled.\u00a0 This also fixed <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=725603\">bug 725603<\/a> and probably fixes some zombie compartments reported in some other add-ons (e.g. <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=726485\">MemChaser<\/a>).<\/p>\n<p>Jan <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=727552\">fixed several leaks in the Galaxytoolbar add-on<\/a>.\u00a0 The new version is 2.6.12.<\/p>\n<p>A small number of add-ons have been found that <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=715221\">disable Firefox&#8217;s XUL cache<\/a>.\u00a0 This is a recipe for disastrous performance, and so Matt Basta <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=725465\">updated the AMO add-on validator to detect this<\/a>.<\/p>\n<h3>Tools<\/h3>\n<p>I landed support for a <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=702300\">new page called about:compartments<\/a>. The exposure of zombie compartments in about:memory has become an extremely powerful leak detection tool.\u00a0 But using about:memory to find zombies is non-trivial &#8212; there are multiple steps and ways to get it wrong.\u00a0 The motivation for about:compartments is to make the detection of zombie compartments as simple as possible.\u00a0 Here&#8217;s a screenshot:<\/p>\n<p><a href=\"http:\/\/blog.mozilla.org\/nnethercote\/files\/2012\/02\/compartments.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-1783\" title=\"compartments\" src=\"http:\/\/blog.mozilla.org\/nnethercote\/files\/2012\/02\/compartments.png\" alt=\"about:compartments screenshot\" width=\"823\" height=\"540\" srcset=\"https:\/\/blog.mozilla.org\/nnethercote\/files\/2012\/02\/compartments.png 823w, https:\/\/blog.mozilla.org\/nnethercote\/files\/2012\/02\/compartments-300x196.png 300w\" sizes=\"(max-width: 823px) 100vw, 823px\" \/><\/a><\/p>\n<p>Some things to note:<\/p>\n<ul>\n<li>It only shows compartments, and all of them.<\/li>\n<li>User compartments from web content (usually the interesting ones) are listed separately from system compartments.<\/li>\n<li>The garbage and cycle collectors are automatically run when the page is loaded, ensuring that dead compartments aren&#8217;t listed.<\/li>\n<li>The &#8220;More verbose&#8221; link at the bottom just causes the truncated URLs to be shown in full.<\/li>\n<li>about:compartments shares a lot of code with about:memory.<\/li>\n<li>I updated the <a href=\"https:\/\/developer.mozilla.org\/en\/Zombie_Compartments\">documentation on zombie compartments<\/a> accordingly.<\/li>\n<\/ul>\n<p>Olli Pettay created <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=726346\">about:cc<\/a>, an add-on that can detect various kinds of document leaks relating to cycle collection.\u00a0 Olli has already found <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=728407\">several leaks<\/a> with this tool.\u00a0 Jan Honza Odvarko has written <a href=\"https:\/\/github.com\/janodvarko\/ccdump\">about:ccdump<\/a>, a similar but prettier add-on.\u00a0 I&#8217;m not certain but I think Olli and Jan are now co-ordinating their efforts.<\/p>\n<p>I mentioned Mozilla QA&#8217;s MemChaser add-on a few weeks ago.\u00a0 It lets you track memory usage and GC\/CC activity easily via the add-on bar, and also allows logging of memory-related activities.\u00a0 It&#8217;s now <a href=\"https:\/\/addons.mozilla.org\/en-US\/firefox\/addon\/memchaser\/\">available on AMO<\/a>, which guarantees you&#8217;ll receive updates as they&#8217;re released.<\/p>\n<p>Jesse Ruderman tweaked his DOM fuzzer and found several new small leaks relating to nsITimers.\u00a0 Jesse also <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=698928\">modified about:memory so that it produces assertions that his fuzzer will catch<\/a>.\u00a0 This means that his fuzzer will detect if any memory reporters produce bogus values.<\/p>\n<h3>Miscellaneous<\/h3>\n<p>Kyle Huey <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=669845\">fixed a zombie compartment that occurred when searching within pages with onclick handlers<\/a>, which is a pretty common operation.<\/p>\n<p>Jeff Muizelaar <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=726764\">fixed a huge Mac-only leak relating to text rendering<\/a>.\u00a0 This was a recent regression that isn&#8217;t present in any released version of Firefox.<\/p>\n<p>Josh Aas <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=633427\">fixed a bug in cookie clearing<\/a> &#8212; prior to Josh&#8217;s fix, if you cleared all cookies, Firefox would launch an instance of the plugin-container process for every plug-in installed, which could cause freezes and memory spikes.<\/p>\n<p>Andrew Quartey <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=710594\">updated the WebGL memory reporters<\/a> to the <a href=\"https:\/\/wiki.mozilla.org\/Memory_Reporting\">new style<\/a>.<\/p>\n<h3>Bug counts<\/h3>\n<p>This week\u2019s bug counts:<\/p>\n<ul>\n<li>P1: 28 (-1\/+3)<\/li>\n<li>P2: 134 (-6\/+9)<\/li>\n<li>P3: 79 (-8\/+11)<\/li>\n<li>Unprioritized: 2 (-1\/+2)<\/li>\n<\/ul>\n<p>Lots of movement there:\u00a0 plenty of bugs fixed, but even more new ones.\u00a0 Roughly 20 of the new ones fell into the following three categories.<\/p>\n<ul>\n<li>Zombie compartments found in AMO add-ons by Kris Maglione and Andreas Wagner.<\/li>\n<li>Leaks found by Olli Pettay&#8217;s new about:cc tool, mentioned above.<\/li>\n<li>Leaks found by Jesse Ruderman&#8217;s tweaked DOM fuzzer, mentioned above.<\/li>\n<\/ul>\n<p>This is a good thing!\u00a0 It shows that new policies and tools are exposing existing problems.\u00a0 I expect this higher level of new bug filing will continue for a couple of weeks.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Lots of activity this week. Leaky add-ons I created a new devmo wiki page documenting common causes of memory leaks in add-ons.\u00a0 I based this on a lovely selection of examples provided by Nils Maier.\u00a0 Unfortunately, I know almost nothing about writing add-ons and so I&#8217;m not happy with the current state of the documentation.\u00a0 [&hellip;]<\/p>\n","protected":false},"author":139,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[15267,4550,119,4554,30,4544,4546],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.mozilla.org\/nnethercote\/wp-json\/wp\/v2\/posts\/1782"}],"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=1782"}],"version-history":[{"count":0,"href":"https:\/\/blog.mozilla.org\/nnethercote\/wp-json\/wp\/v2\/posts\/1782\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.mozilla.org\/nnethercote\/wp-json\/wp\/v2\/media?parent=1782"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.mozilla.org\/nnethercote\/wp-json\/wp\/v2\/categories?post=1782"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.mozilla.org\/nnethercote\/wp-json\/wp\/v2\/tags?post=1782"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}