{"id":1094,"date":"2011-08-03T16:04:32","date_gmt":"2011-08-03T05:04:32","guid":{"rendered":"http:\/\/blog.mozilla.org\/nnethercote\/?p=1094"},"modified":"2011-08-03T16:10:47","modified_gmt":"2011-08-03T05:10:47","slug":"memshrink-progress-week-7","status":"publish","type":"post","link":"https:\/\/blog.mozilla.org\/nnethercote\/2011\/08\/03\/memshrink-progress-week-7\/","title":{"rendered":"MemShrink progress, week 7"},"content":{"rendered":"<p>Lots of good stuff this week.<\/p>\n<h3>Blog posts<\/h3>\n<p>There were four great blog posts this week relating to memory usage in Firefox.<\/p>\n<ul>\n<li>Gregor Wagner <a href=\"http:\/\/gregor-wagner.com\/?p=79\">compared Firefox and Google Chrome in a 150-tab stress test<\/a>.\u00a0 Firefox won hands down.\u00a0 It appears that Chrome just can&#8217;t handle large numbers of tabs open at once;\u00a0 I&#8217;d be interested to hear if anyone can confirm or refute that finding.<\/li>\n<li>Gian-Carlo Pascutto described how he is <a href=\"http:\/\/www.morbo.org\/2011\/07\/bringing-safebrowsing-to-mobile-devies.html\">making Firefox&#8217;s SafeBrowsing implementation more memory-efficient<\/a>.\u00a0 This will fix <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=650649\">problems seen in the existing implementation<\/a>, and allow SafeBrowsing to be turned on in Fennec.<\/li>\n<li>Chris Pearce wrote about <a href=\"http:\/\/blog.pearce.org.nz\/2011\/07\/reducing-memory-overhead-of-thread.html\">reducing the size of thread stacks<\/a>.<\/li>\n<li>Steve Fink told the tale of a <a href=\"http:\/\/blog.mozilla.org\/sfink\/2011\/08\/02\/zombie-hunting\/\">zombie (compartment) hunt<\/a>.<\/li>\n<\/ul>\n<h3>Web workers<\/h3>\n<p>Ben Turner landed a <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=649537\">complete reworking of web workers<\/a>.\u00a0 This fixed <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=617569\">three<\/a> <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=669545\">MemShrink<\/a> <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=673304\">bugs<\/a>, and probably a number of others.\u00a0 Ben also added <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=674721\">memory reporters so that web workers show up in about:memory<\/a>.<\/p>\n<h3>Add-ons<\/h3>\n<p>I always cringe when someone files a bug report complaining about Firefox&#8217;s memory usage and they have many (e.g. 10, 20 or more) add-ons installed.\u00a0 The chances of all of those add-ons behaving themselves is pretty low, unfortunately.\u00a0 For example, one user found that the <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=674475\">CyberSearch 2.0.8 add-on causes the places SQLite database to grow to over 300MB<\/a>.\u00a0 Another user found that <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=673409\">one or more add-ons caused that same database to grow to 1.2GB<\/a>(!);\u00a0 the add-on(s) responsible has not yet been identified.<\/p>\n<p>This kind of thing is terrible for perceptions of Firefox.\u00a0 Maybe <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=674210\">limiting the size of places.sqlite<\/a> will help?<\/p>\n<p>In better add-on-related news, Jan Honza Odvarko <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=669730#c10\">fixed a bad memory leak in Firebug<\/a>, one that was causing zombie compartments on pages where Firebug hadn&#8217;t even been enabled.\u00a0 Now Firebug only causes zombie compartments for pages where Firebug has been enabled, but Steve Fink is making progress there, as he described in his blog post that I linked to above.<\/p>\n<p>Two other add-ons known to cause memory problems are <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=674535\">Lastpass<\/a> and <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=672619\">It&#8217;s All Text<\/a>.<\/p>\n<h3>Miscellaneous<\/h3>\n<p>Andrew McCreight is making great progress on his <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=423032\">static analysis to find cycle collection leaks<\/a>.\u00a0 This week he found a <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=674658\">problem in nsDOMEventTargetWrapperCache<\/a>, which Olli Pettay then fixed.<\/p>\n<p>If you ask a heap allocator like jemalloc for a certain number of bytes, it&#8217;ll often round that request size up to a number such as a power-of-two.\u00a0 For example, if you ask for 99 bytes it&#8217;ll give you 112 or 128.\u00a0 I found that this is <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=675136\">contributing to the high &#8220;heap-unclassified&#8221; number in about:memory<\/a>.\u00a0 I also stumbled across <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=675132\">two<\/a> <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=675150\">cases<\/a> where Firefox itself deliberately requests a power-of-two-sized block of memory (with the aim of avoiding round-up in the heap allocator) but botches the calculation such that it asks for a block slightly bigger than a power-of-two, which jemalloc then rounds up again.\u00a0 Luke Wagner fixed the first of these, and I have patches awaiting review to fix the second.<\/p>\n<p>Finally, I should mention <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=658738\">bug 658738<\/a> and its children.\u00a0 D\u00e3o Gottwald and others have been working tirelessly to fix leaked windows in browser-chrome tests.\u00a0 This has involved both (a) fixing problems with the tests, and (b) fixing problems with the browser.\u00a0 Eleven child bugs have already been fixed, and there are four still open.<\/p>\n<h3>Bug counts<\/h3>\n<p>Here&#8217;s the change in MemShrink bug counts.<\/p>\n<ul>\n<li>P1: 27 (+1)<\/li>\n<li>P2: 53 (+4)<\/li>\n<li>P3: 35 (+2)<\/li>\n<li>P4: 11 (+5)<\/li>\n<\/ul>\n<p>Increases all across the board.\u00a0 Once again I think this reflects the increasing amount of work being done&#8230; but I keep saying that.\u00a0 Therefore, beginning next week, I&#8217;ll show how many bugs in each category were fixed and how many were added, e.g. &#8220;P1: 27 (-2, +3)&#8221;.\u00a0 That&#8217;ll give a better idea of progress.\u00a0 (I can&#8217;t start it until next week because I&#8217;ve only today started recording enough info about the open bugs to get those numbers.\u00a0 And before you suggest that I use a time-based Bugzilla search instead, the problem with that is that I write this progress report at a slightly different time each week, so if I just search during the last week I may double-count or fail to count some bugs.)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Lots of good stuff this week. Blog posts There were four great blog posts this week relating to memory usage in Firefox. Gregor Wagner compared Firefox and Google Chrome in a 150-tab stress test.\u00a0 Firefox won hands down.\u00a0 It appears that Chrome just can&#8217;t handle large numbers of tabs open at once;\u00a0 I&#8217;d be interested [&hellip;]<\/p>\n","protected":false},"author":139,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4550,30,4544,4546],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.mozilla.org\/nnethercote\/wp-json\/wp\/v2\/posts\/1094"}],"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=1094"}],"version-history":[{"count":0,"href":"https:\/\/blog.mozilla.org\/nnethercote\/wp-json\/wp\/v2\/posts\/1094\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.mozilla.org\/nnethercote\/wp-json\/wp\/v2\/media?parent=1094"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.mozilla.org\/nnethercote\/wp-json\/wp\/v2\/categories?post=1094"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.mozilla.org\/nnethercote\/wp-json\/wp\/v2\/tags?post=1094"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}