{"id":1335,"date":"2011-10-19T14:53:02","date_gmt":"2011-10-19T03:53:02","guid":{"rendered":"http:\/\/blog.mozilla.org\/nnethercote\/?p=1335"},"modified":"2011-10-20T09:11:31","modified_gmt":"2011-10-19T22:11:31","slug":"memshrink-progress-weeks-13-18","status":"publish","type":"post","link":"https:\/\/blog.mozilla.org\/nnethercote\/2011\/10\/19\/memshrink-progress-weeks-13-18\/","title":{"rendered":"MemShrink Progress, weeks 13&#8211;18"},"content":{"rendered":"<p>I&#8217;ve been on vacation, so this report covers (incompletely) the past six weeks&#8217; worth of MemShrink improvements.<\/p>\n<h3>Big Things<\/h3>\n<p>Paul Biggar and Mike Hommey <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=414946\">enabled jemalloc on Mac 10.6<\/a>.\u00a0 This will hopefully reduce fragmentation on that platform.\u00a0 And it brings it in line with Windows, Linux and Android.\u00a0 Now we just need it for <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=694335\">Mac 10.5<\/a> and <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=694896\">Mac 10.7<\/a>.<\/p>\n<p>Oleg Romashin found a way to <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=693930\">drop some Thebes layers in inactive tabs in Fennec<\/a>.\u00a0 I won&#8217;t pretend to understand the details of this bug, but if I&#8217;ve understood correctly it can saves 12MB or more per background tab.<\/p>\n<p>Jeff Muizelaar <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=573583\">turned on decode-on-draw<\/a>.\u00a0 This means that if you open a new page in a background tab, none of its images will be decoded until you switch to that tab.\u00a0 Previously any images would be decoded and then discarded after 10 to 20 seconds (unless you switched to the tab before the time-out occurred).\u00a0 This change can save a lot of memory (and CPU time) for users browsing image-heavy sites.<\/p>\n<p>Gian-Carlo Pascutto <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=669410\">optimized the safe browsing database<\/a>.\u00a0 This hopefully has fixed our <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=650649\">url-classifier bloat problems<\/a>.\u00a0 (I plan to verify this soon.)<\/p>\n<p>Chris Leary and Jonathan &#8220;Duke&#8221; Leto <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=673188\">made regexp compilation lazy.<\/a>\u00a0 This potentially saves 10s or even 100s of MBs of memory in some cases by not compiling some regexps, and also allowing regexps to be GC&#8217;d more quickly.\u00a0 There were some possible performance regressions from this patch, it&#8217;s unclear from the bug what exactly the state of these are.<\/p>\n<p>Justin Lebar <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=681755\">converted some uses of nsTArray to nsAutoTArray<\/a> (and also <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=688619\">here<\/a>).\u00a0 These avoided some calls to malloc (in the latter case, around 3% of all malloc calls!) and may help reduce heap fragmentation a little.\u00a0 Robert O&#8217;Callahan did a separate, similar nsAutoTArray change <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=685404\">here<\/a>. \u00a0Justin also <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=691192\">avoided another 1% of total malloc calls in JSAutoEnterCompartment<\/a>.<\/p>\n<p>Chris Leary <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=684039\">rewrote JSArena<\/a>, which avoided some <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=675150\">wasted memory<\/a>, as well as replacing some hoary old C code with sleek modern C++.<\/p>\n<h3>SMALLER THINGS<\/h3>\n<p>A new contributor named Jiten (a.k.a. deLta30) <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=655647\">fixed about:memory&#8217;s GC and CC buttons so they trigger collections in both the content and chrome process in Fennec<\/a>.\u00a0 Previously only the chrome process was affected.\u00a0 (I&#8217;m not sure how this change will be affected by the decision to switch to the native chrome process in Fennec.)\u00a0 Great work, Jiten!<\/p>\n<p>I <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=684111\">avoided some wasted space in the JS code generator<\/a>, and <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=685429\">some more in the parser<\/a>.\u00a0 Justin Lebar did <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=685438\">something similar in nsTArray_base<\/a>.<\/p>\n<p>Jonathan Kew <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=671297\">added a memory reporter for textruns and associated data<\/a>.\u00a0 Justin Lebar <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=682437\">added the &#8220;history-links-hashtable&#8221; memory reporter<\/a>.<\/p>\n<p>Justin Lebar <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=686345\">fixed some bogus &#8220;canvas-2d-pixel-bytes&#8221; values in about:memory<\/a>.<\/p>\n<p>Brian Bondy fixed <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=679196\">a leak in Windows drag and drop code<\/a>.<\/p>\n<p>Tim Taubert wrote about <a href=\"http:\/\/timtaubert.de\/2011\/09\/leak-hunting-in-browser-chrome-mochitests\/\">finding leaks in browser-chrome mochitests<\/a>.<\/p>\n<h3>Bug Counts<\/h3>\n<p>The current bug counts are as follows.\u00a0 The differences are against the MemShrink week 12 counts.<\/p>\n<ul>\n<li>P1: 37 (-3, +11)<\/li>\n<li>P2: 108 (-9, +37)<\/li>\n<li>P3: 53 (-1, +14)<\/li>\n<li>Unprioritized: 6 (-21, +5)<\/li>\n<\/ul>\n<p>They&#8217;re still going up.\u00a0 The good news is that my gut feeling is that not many of these bugs are problems reported by users.\u00a0 (And those that are often are caused by add-ons.)\u00a0 Most of the new reports are ideas for improvements from developers.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve been on vacation, so this report covers (incompletely) the past six weeks&#8217; worth of MemShrink improvements. Big Things Paul Biggar and Mike Hommey enabled jemalloc on Mac 10.6.\u00a0 This will hopefully reduce fragmentation on that platform.\u00a0 And it brings it in line with Windows, Linux and Android.\u00a0 Now we just need it for Mac [&hellip;]<\/p>\n","protected":false},"author":139,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[451,30,4544,4546],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.mozilla.org\/nnethercote\/wp-json\/wp\/v2\/posts\/1335"}],"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=1335"}],"version-history":[{"count":0,"href":"https:\/\/blog.mozilla.org\/nnethercote\/wp-json\/wp\/v2\/posts\/1335\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.mozilla.org\/nnethercote\/wp-json\/wp\/v2\/media?parent=1335"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.mozilla.org\/nnethercote\/wp-json\/wp\/v2\/categories?post=1335"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.mozilla.org\/nnethercote\/wp-json\/wp\/v2\/tags?post=1335"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}