{"id":2903,"date":"2014-06-16T14:59:41","date_gmt":"2014-06-16T03:59:41","guid":{"rendered":"http:\/\/blog.mozilla.org\/nnethercote\/?p=2903"},"modified":"2014-06-16T14:59:41","modified_gmt":"2014-06-16T03:59:41","slug":"memshrinks-3rd-birthday","status":"publish","type":"post","link":"https:\/\/blog.mozilla.org\/nnethercote\/2014\/06\/16\/memshrinks-3rd-birthday\/","title":{"rendered":"MemShrink&#8217;s 3rd birthday"},"content":{"rendered":"<p>June 14, 2014 was the third anniversary of the first MemShrink meeting. MemShrink is a mature effort at this point, and many of the problems that motivated its creation have been fixed. Nonetheless, there are still some areas for improvement. So, <a href=\"https:\/\/blog.mozilla.org\/nnethercote\/2013\/06\/15\/memshrinks-2nd-birthday\/\">as I did at this time last year<\/a>, I&#8217;ll take the opportunity to update the &#8220;big ticket items&#8221; list.<\/p>\n<h3>The Old Big Ticket Items List<\/h3>\n<h4>#5: pdf.js<\/h4>\n<p>pdf.js is the PDF viewer that now ships by default in Firefox. I greatly reduced its memory usage in two rounds, <a href=\"https:\/\/blog.mozilla.org\/nnethercote\/2014\/02\/07\/a-slimmer-and-faster-pdf-js\/\">first in February<\/a>, and <a href=\"https:\/\/blog.mozilla.org\/nnethercote\/2014\/06\/16\/an-even-slimmer-pdf-js\/\">again in June<\/a>. The first round of improvements were released in Firefox 29, and the second round is due to be released in Firefox 33, which should be out in mid-October.<\/p>\n<p>pdf.js will still use more memory than native PDF viewers, but the situation has improved enough that it can be removed from this list.<\/p>\n<h4>#4: Dev tools<\/h4>\n<p>See below.<\/p>\n<h4>#3: B2G Nuwa<\/h4>\n<p>Cervantes Yu, Thinker Li, and others succeeded in landing <a href=\"https:\/\/blog.mozilla.org\/nnethercote\/2014\/02\/11\/nuwa-has-landed\/\">Nuwa<\/a>, an impressive technical achievement that increased the amount of memory sharing between different processes on Firefox OS. This allows many more apps to run at once. I think this is present in Firefox OS 1.3 and later.<\/p>\n<h4>#2: Compacting Generational GC<\/h4>\n<p>See below.<\/p>\n<h4>#1: Better Foreground Tab Image Handling<\/h4>\n<p>Timothy Nikkel <a href=\"https:\/\/blog.mozilla.org\/nnethercote\/2013\/10\/01\/memshrink-progress-week-117-120\/\">completely fixed<\/a> the massive spikes in decoded image data that we used to get on image-heavy pages. This was a fantastic improvement that shipped in Firefox 26.<\/p>\n<h3>The New Big Ticket Items List<\/h3>\n<p>In a break from tradition, I will present the items in alphabetical order, rather than ranking them. This reflects the fact that I don&#8217;t have a clear opinion on the relevant importance of these different items. (I view this as a good thing, because it means that I feel there aren&#8217;t any hair-on-fire problems.)<\/p>\n<h4>Better regression detection<\/h4>\n<p><a title=\"areweslimyet.com data is now exportable and diffable\" href=\"https:\/\/areweslimyet.com\/\">areweslimyet.com<\/a> (a.k.a. AWSY) is our best tool for detecting memory usage regressions. It currently tracks Firefox and Firefox for Android, and there are <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=899194\">plans<\/a> to integrate Firefox OS.<\/p>\n<p>Unfortunately, although AWSY has been successful at detecting large regressions, leading to them being fixed, its measurements are noisy enough that detecting smaller regressions is difficult. As a result, the general trend of the graphs has been upward. I do not think this is as bad as it looks at first glance, because Firefox&#8217;s behaviour in the worst cases &#8212; which matter more than the average case &#8212; is much better than it used to be. Nonetheless, <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=1000268\"> improved sensitivity<\/a> here would be an excellent thing, and Eric Rahm is actively working on this.<\/p>\n<h4>Developer tools<\/h4>\n<p>Developer-oriented memory profiling tools are under active development by Nick Fitzgerald, Jim Blandy, and others. A lot of the necessary profiling infrastructure is in place, and this seems to be progressing well, though I don&#8217;t know when it&#8217;s expected to be finished.<\/p>\n<p>By the way, if you haven&#8217;t tried Firefox&#8217;s dev tools recently, you should! They have improved an incredible amount in the past year or so.<\/p>\n<h4>GC Arena Fragmentation<\/h4>\n<p><a href=\"https:\/\/blog.mozilla.org\/nnethercote\/2014\/03\/31\/generational-gc-has-landed\/\">Generational GC landed<\/a> a few months ago. I had been hoping that this would help reduce GC fragmentation, but the effect was small. It looks like <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=650161\">compacting GC<\/a> is what&#8217;s needed to make a big difference here, though some <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=1017165\">smaller tweaks<\/a> may help things a little.<\/p>\n<h4>Tarako<\/h4>\n<p><em><a href=\"https:\/\/wiki.mozilla.org\/FirefoxOS\/Tarako\">Tarako<\/a><\/em> is the codename for the &#8220;<a href=\"http:\/\/www.cnet.com\/au\/news\/mozillas-25-firefox-os-phones-look-to-score-in-india\/\">$25 phone<\/a>&#8221; running Firefox OS that will ship in India and other countries later this year. It has a paltry 128 MiB of RAM, so memory usage is critical. Since the hardware first became available to Mozilla employees at the start of the year, Tarako has improved from &#8220;almost unusable&#8221; to &#8220;not bad&#8221;. But apps still close due to OOMs fairly frequently, especially when a user does something that involves two apps working together in some way.<\/p>\n<p>There is no single change that will decisively fix this problem for Tarako;\u00a0 further improvements will require an ongoing grind of work from many engineers. Improvements made for Tarako are also likely to benefit higher-end Firefox OS devices as well.<\/p>\n<h4>Windows OOM crashes<\/h4>\n<p>The number of out-of-memory (OOM) crashes that occur on Windows is relatively high. A sizeable fraction of these appear to be 32-bit virtual OOM crashes, caused by <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=965936\">running out of address space<\/a>.<\/p>\n<p>Things that will mitigate this include modifications to <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=1005844\">jemalloc<\/a> and the <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=1005849\">JS allocator<\/a>, as well as <a href=\"https:\/\/wiki.mozilla.org\/Electrolysis\">Electrolysis<\/a>. And some additional\u00a0<a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=1007534\">data<\/a> and <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=1001760\">analysis<\/a> may help us understand the problem better.<\/p>\n<p>The ultimate solution, for users on 64-bit versions of Windows, is <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=558448\">64-bit Firefox builds for Windows<\/a>, though it&#8217;ll be a while before those builds are in good enough shape to ship to regular users.<\/p>\n<h3>Summary<\/h3>\n<p>Three items from the old list (pdf.js, Nuwa, image handling) have been ticked off.\u00a0 Two items remain (devtools, GC fragmentation), the latter in altered form, and both are a lot closer to completion than they were. Three new items (regression detection, Tarako, and Windows OOMs) have been added.<\/p>\n<p>Let me know if I\u2019ve omitted anything important!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>June 14, 2014 was the third anniversary of the first MemShrink meeting. MemShrink is a mature effort at this point, and many of the problems that motivated its creation have been fixed. Nonetheless, there are still some areas for improvement. So, as I did at this time last year, I&#8217;ll take the opportunity to update [&hellip;]<\/p>\n","protected":false},"author":139,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4261,451,30,4555,4544,4546,19295],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.mozilla.org\/nnethercote\/wp-json\/wp\/v2\/posts\/2903"}],"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=2903"}],"version-history":[{"count":0,"href":"https:\/\/blog.mozilla.org\/nnethercote\/wp-json\/wp\/v2\/posts\/2903\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.mozilla.org\/nnethercote\/wp-json\/wp\/v2\/media?parent=2903"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.mozilla.org\/nnethercote\/wp-json\/wp\/v2\/categories?post=2903"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.mozilla.org\/nnethercote\/wp-json\/wp\/v2\/tags?post=2903"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}