{"id":2636,"date":"2013-07-10T16:22:53","date_gmt":"2013-07-10T05:22:53","guid":{"rendered":"http:\/\/blog.mozilla.org\/nnethercote\/?p=2636"},"modified":"2013-07-10T17:51:08","modified_gmt":"2013-07-10T06:51:08","slug":"memshrink-progress-week-105-108","status":"publish","type":"post","link":"https:\/\/blog.mozilla.org\/nnethercote\/2013\/07\/10\/memshrink-progress-week-105-108\/","title":{"rendered":"MemShrink progress, week 105&#8211;108"},"content":{"rendered":"<p>This is the first of the every-four-weeks MemShrink reports that I&#8217;m now doing.\u00a0 The <a href=\"https:\/\/bugzilla.mozilla.org\/buglist.cgi?list_id=7115158&amp;resolution=FIXED&amp;status_whiteboard_type=allwordssubstr&amp;chfieldto=2013-07-09&amp;chfield=bug_status&amp;query_format=advanced&amp;chfieldfrom=2013-06-11&amp;chfieldvalue=RESOLVED&amp;status_whiteboard=MemShrink&amp;bug_status=RESOLVED&amp;bug_status=VERIFIED&amp;bug_status=CLOSED&amp;known_name=MemShrink%20bugs%20resolved%20in%20the%20past%20four%20weeks\">21 bugs<\/a> fixed in the past four weeks include 11 leak fixes, which is great, but I won&#8217;t bother describing them individually.\u00a0 Especially when I have several other particularly impressive fixes to describe&#8230;<\/p>\n<h3>Image Handling<\/h3>\n<p>Back in March <a href=\"https:\/\/blog.mozilla.org\/nnethercote\/2013\/03\/07\/memshrink-progress-week-89-90\/\">I described how Timothy Nikkel had greatly improved Firefox&#8217;s handling of image-heavy pages<\/a>.\u00a0 Unfortunately, the fix had to be disabled in Firefox 22 and Firefox 23 because it caused jerky scrolling on pages with lots of small images, such as Pinterest.<\/p>\n<p>Happily, Timothy <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=845147\">has now fixed those problems<\/a>, and so his previous change has been re-enabled in Firefox 24.\u00a0 This takes a big chunk out of the #1 item on the <a href=\"https:\/\/blog.mozilla.org\/nnethercote\/2013\/06\/15\/memshrinks-2nd-birthday\/\">MemShrink big ticket items list<\/a>.\u00a0 Fantastic news!<\/p>\n<h3>Lazy Bytecode Generation<\/h3>\n<p>Brian Hackett finished implementing <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=678037\">lazy bytecode generation<\/a>.\u00a0 This change means that JavaScript functions don&#8217;t have bytecode generated for them until they run.\u00a0 Because lots of websites use libraries like jQuery, in practice a lot of JS functions are never run, and we&#8217;ve found this can reduce Firefox\u2019s memory consumption by 5% or more on common workloads!\u00a0 That\u2019s a huge, general improvement.<\/p>\n<p>Furthermore, it significantly reduces the number of things that are allocated on the GC heap (i.e. scripts, strings, objects and shapes that are created when bytecode for a function is generated).\u00a0 This reduces pressure on the GC which makes it less likely we\u2019ll have bad GC behaviour (e.g. pauses, or too much memory consumption) in cases where the GC heuristics aren\u2019t optimal.<\/p>\n<p>The completion of this finished off item #5 on the <a href=\"https:\/\/blog.mozilla.org\/nnethercote\/2012\/07\/11\/memshrink-progress-week-55-56\/\">old Memshrink big ticket items list<\/a>.\u00a0 Great stuff.\u00a0 This will be in Firefox 24.<\/p>\n<h3>Add-on Memory Reporting<\/h3>\n<p>Nils Maier <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=846019\">implemented add-on memory reporting in about:memory<\/a>.\u00a0 Here&#8217;s some example output from my current session.<\/p>\n<pre>\u251c\u2500\u2500\u250033,345,136 B (05.08%) -- add-ons\r\n\u2502\u00a0\u00a0 \u251c\u2500\u250018,818,336 B (02.87%) ++ {d10d0bf8-f5b5-c8b4-a8b2-2b9879e08c5d}\r\n\u2502\u00a0\u00a0 \u251c\u2500\u250011,830,424 B (01.80%) ++ {59c81df5-4b7a-477b-912d-4e0fdf64e5f2}\r\n\u2502\u00a0\u00a0 \u2514\u2500\u2500\u25002,696,376 B (00.41%) ++ treestyletab@piro.sakura.ne.jp\/js-non-window\/zones\/zone(0x7fbd7bf53800)<\/pre>\n<p>It&#8217;s obvious that Tree Style Tabs is taking up 2.7 MB.\u00a0 What about the other two entries?\u00a0 It&#8217;s not immediately obvious, but if I look in about:support at the &#8220;extensions&#8221; section I can see that they are AdBlock Plus and ChatZilla.<\/p>\n<p>If you&#8217;re wondering why those add-ons are reported as hex strings, it&#8217;s due to a combination of the packaging of each individual add-on, and the fact that the memory reporting code is C++ and the add-on identification code is JS and there aren&#8217;t yet good APIs to communicate between the two.\u00a0 (Yes, it&#8217;s not ideal and should be improved, but it&#8217;s a good start.)\u00a0 Also, not all add-on memory is reported, just that in JS compartments;\u00a0 old-style XUL add-ons in particular can have their memory consumption under-reported.<\/p>\n<p>Despite the shortcomings, this is a big deal.\u00a0 Users have been asking for this information for <em>years<\/em>, and we&#8217;ve finally got it.\u00a0 (Admittedly, the fact that we&#8217;ve tamed add-on leaks makes it less important than it used to be, but it&#8217;s still cool.)\u00a0 This will also be in Firefox 24.<\/p>\n<h3>b2g<\/h3>\n<p>Gregor Wagner has landed a <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=850175\">nice<\/a> <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=887652\">collection<\/a> of patches to help the Twitter and Notes+ apps on B2G.<\/p>\n<p>While on the topic of B2G, in today&#8217;s MemShrink meeting we discussed the ongoing problem of slow memory leaks in the main B2G process.\u00a0 Such leaks can cause the phone to crash or become flaky after its been running for hours or days or weeks, and they&#8217;re really painful to reproduce and diagnose.\u00a0 Our partners are finding these leaks when doing multi-hour stress tests as part of their QA processes.\u00a0 In contrast, Mozilla doesn&#8217;t really have any such testing, and as a result we are reacting, flat-footed, to external reports, rather than catching them early ourselves.\u00a0 This is a big problem because users will rightly expect to have their phones run for weeks (or even months) without rebooting.<\/p>\n<p>Those of us present at the meeting weren&#8217;t quite sure how we can improve our QA situation to look for these leaks.\u00a0 I&#8217;d be interested to hear any suggestions.\u00a0 Thanks!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is the first of the every-four-weeks MemShrink reports that I&#8217;m now doing.\u00a0 The 21 bugs fixed in the past four weeks include 11 leak fixes, which is great, but I won&#8217;t bother describing them individually.\u00a0 Especially when I have several other particularly impressive fixes to describe&#8230; Image Handling Back in March I described how [&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\/2636"}],"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=2636"}],"version-history":[{"count":0,"href":"https:\/\/blog.mozilla.org\/nnethercote\/wp-json\/wp\/v2\/posts\/2636\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.mozilla.org\/nnethercote\/wp-json\/wp\/v2\/media?parent=2636"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.mozilla.org\/nnethercote\/wp-json\/wp\/v2\/categories?post=2636"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.mozilla.org\/nnethercote\/wp-json\/wp\/v2\/tags?post=2636"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}