{"id":2579,"date":"2013-04-10T11:17:07","date_gmt":"2013-04-10T00:17:07","guid":{"rendered":"http:\/\/blog.mozilla.org\/nnethercote\/?p=2579"},"modified":"2013-04-11T16:04:00","modified_gmt":"2013-04-11T05:04:00","slug":"gzipped-json-is-now-the-preferred-format-for-attaching-memory-report-data-to-bugs","status":"publish","type":"post","link":"https:\/\/blog.mozilla.org\/nnethercote\/2013\/04\/10\/gzipped-json-is-now-the-preferred-format-for-attaching-memory-report-data-to-bugs\/","title":{"rendered":"Gzipped JSON is now the preferred format for attaching memory report data to bugs"},"content":{"rendered":"<h3>Old: Text<\/h3>\n<p>about:memory is our main memory profiling tool.\u00a0 You can copy and paste the memory reports shown by about:memory and they will reproduce nicely &#8212; so long as the displaying text is a fixed-width font &#8212; as the following example shows.<\/p>\n<pre>Main Process\r\n\r\nExplicit Allocations\r\n536.22 MB (100.0%) -- explicit\r\n\u251c\u2500\u2500217.45 MB (40.55%) -- window-objects\r\n\u2502\u00a0 \u251c\u2500\u2500\u250091.55 MB (17.07%) -- top(https:\/\/mail.google.com\/mail\/u\/0\/#label\/A-moz%2Fbugz\/13d41da77907a707, id=16)\/active\r\n\u2502\u00a0 \u2502\u00a0\u00a0 \u251c\u2500\u250061.18 MB (11.41%) -- window(https:\/\/mail.google.com\/_\/mail-static\/_\/js\/main\/m_i,t\/rt=h\/ver=sobKNxkH_hk.en.\/sv=1\/am=!rsy2VLKefbT1RPF-0_JbQoI4nDfwRxdk-CbEiLu_TGxDGzw05OfUOUODZR_O2flp0CcdPg\/d=1)\r\n\u2502\u00a0 \u2502\u00a0\u00a0 \u2502\u00a0 \u251c\u2500\u250056.29 MB (10.50%) -- js\r\n\u2502\u00a0 \u2502\u00a0\u00a0 \u2502\u00a0 \u2502\u00a0 \u251c\u2500\u250056.11 MB (10.46%) -- compartment(https:\/\/mail.google.com\/_\/mail-static\/_\/js\/main\/m_i,t\/rt=h\/ver=sobKNxkH_hk.en.\/sv=1\/am=!rsy2VLKefbT1RPF-0_JbQoI4nDfwRxdk-CbEiLu_TGxDGzw05OfUOUODZR_O2flp0CcdPg\/d=1)\r\n\u2502\u00a0 \u2502\u00a0\u00a0 \u2502\u00a0 \u2502\u00a0 \u2502\u00a0 \u251c\u2500\u250035.23 MB (06.57%) -- gc-heap\r\n\u2502\u00a0 \u2502\u00a0\u00a0 \u2502\u00a0 \u2502\u00a0 \u2502\u00a0 \u2502\u00a0 \u251c\u2500\u250018.17 MB (03.39%) -- objects\r\n\u2502\u00a0 \u2502\u00a0\u00a0 \u2502\u00a0 \u2502\u00a0 \u2502\u00a0 \u2502\u00a0 \u2502\u00a0 \u251c\u2500\u2500\u25009.88 MB (01.84%) \u2500\u2500 dense-array\r\n\u2502\u00a0 \u2502\u00a0\u00a0 \u2502\u00a0 \u2502\u00a0 \u2502\u00a0 \u2502\u00a0 \u2502\u00a0 \u251c\u2500\u2500\u25006.08 MB (01.13%) \u2500\u2500 ordinary\r\n\u2502\u00a0 \u2502\u00a0\u00a0 \u2502\u00a0 \u2502\u00a0 \u2502\u00a0 \u2502\u00a0 \u2502\u00a0 \u2514\u2500\u2500\u25002.21 MB (00.41%) ++ (2 tiny)\r\n\u2502\u00a0 \u2502\u00a0\u00a0 \u2502\u00a0 \u2502\u00a0 \u2502\u00a0 \u2502\u00a0 \u251c\u2500\u250010.71 MB (02.00%) ++ (6 tiny)\r\n\u2502\u00a0 \u2502\u00a0\u00a0 \u2502\u00a0 \u2502\u00a0 \u2502\u00a0 \u2502\u00a0 \u2514\u2500\u2500\u25006.35 MB (01.18%) \u2500\u2500 unused-gc-things\r\n\u2502\u00a0 \u2502\u00a0\u00a0 \u2502\u00a0 \u2502\u00a0 \u2502\u00a0 \u251c\u2500\u250012.01 MB (02.24%) ++ (7 tiny)\r\n\u2502\u00a0 \u2502\u00a0\u00a0 \u2502\u00a0 \u2502\u00a0 \u2502\u00a0 \u2514\u2500\u2500\u25008.86 MB (01.65%) ++ objects-extra\r\n\u2502\u00a0 \u2502\u00a0\u00a0 \u2502\u00a0 \u2502\u00a0 \u2514\u2500\u2500\u25000.19 MB (00.04%) ++ compartment(https:\/\/mail.google.com\/_\/mail-static\/_\/js\/main\/m_i,t\/rt=h\/ver=sobKNxkH_hk.en.\/sv=1\/am=!rsy2VLKefbT1RPF-0_JbQoI4nDfwRxdk-CbEiLu_TGxDGzw05OfUOUODZR_O2flp0CcdPg\/d=1, about:blank)\r\n\u2502\u00a0 \u2502\u00a0\u00a0 \u2502\u00a0 \u2514\u2500\u2500\u25004.89 MB (00.91%) ++ (4 tiny)<\/pre>\n<p>Accordingly, until now the preferred way of reporting about:memory&#8217;s data in bug reports has been to include a copy of the entire contents of about:memory?verbose.<\/p>\n<p>This worked well when about:memory contained a few dozen lines.\u00a0 But the level of detail in the underlying memory reporters has increased greatly since then.\u00a0 This is a good thing &#8212; more data is helpful &#8212; but it means that a full about:memory?verbose is now typically thousands of lines.\u00a0 When viewing the data directly in about:memory?verbose this isn&#8217;t a problem, because you can easily collapse and expand sub-trees to focus on the interesting parts.\u00a0 However, when reading pasted data as text, it&#8217;s overwhelming, even for experts.<\/p>\n<h3>New: Gzipped JSON<\/h3>\n<p>With the landing of <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=848560\">bug 848560<\/a>, about:memory can now import and export memory reports as gzipped JSON.\u00a0 Use the &#8220;Write reports to a file&#8221; and &#8220;Read reports from a file&#8221; buttons at the bottom of about:memory.\u00a0 (Note: the UI will <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=856917\">likely change soon<\/a>, but not substantively.)<\/p>\n<p>(The JSON schema is documented in a comment near the top of xpcom\/base\/nsIMemoryInfoDumper.idl, for those who are interested.)<\/p>\n<p>This is now the preferred format for attaching memory report data to bug reports.\u00a0 It has two important advantages over text.<\/p>\n<ul>\n<li>When you load one of these files into about:memory, you can do the aforementioned collapsing and expanding of sub-trees.<\/li>\n<li>If you have two of these files, you can diff them using toolkit\/components\/aboutmemory\/tools\/diff-memory-reports.js.\u00a0 (For the moment you&#8217;ll have to ungzip both files first, which is stupid.\u00a0 Hopefully this&#8217;ll be <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=860105\">fixed soon<\/a>.)<\/li>\n<\/ul>\n<p>The ability to compute memory report diffs will be extremely useful for diagnosing cases where Firefox&#8217;s memory consumption increases unexpectedly.\u00a0 (There are already <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=849743\">two<\/a> <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=857806\">bugs<\/a> that are waiting on this feature for a better diagnosis.)<\/p>\n<p>There is a bug open to implement a <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=859603\">&#8220;Load reports from URL&#8221;<\/a> feature in about:memory, which will make the viewing memory reports attached to bugs even easier.\u00a0 It&#8217;s currently unassigned;\u00a0 please email me or comment in the bug if you are interested in implementing it.<\/p>\n<p>Finally, although the gzipped JSON format is now the preferred format for transferring the full memory report data, copy and paste is still useful for communicating snippets of about:memory&#8217;s contents.\u00a0 Support for it won&#8217;t be disappearing.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Old: Text about:memory is our main memory profiling tool.\u00a0 You can copy and paste the memory reports shown by about:memory and they will reproduce nicely &#8212; so long as the displaying text is a fixed-width font &#8212; as the following example shows. Main Process Explicit Allocations 536.22 MB (100.0%) &#8212; explicit \u251c\u2500\u2500217.45 MB (40.55%) &#8212; [&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,4546],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.mozilla.org\/nnethercote\/wp-json\/wp\/v2\/posts\/2579"}],"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=2579"}],"version-history":[{"count":0,"href":"https:\/\/blog.mozilla.org\/nnethercote\/wp-json\/wp\/v2\/posts\/2579\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.mozilla.org\/nnethercote\/wp-json\/wp\/v2\/media?parent=2579"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.mozilla.org\/nnethercote\/wp-json\/wp\/v2\/categories?post=2579"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.mozilla.org\/nnethercote\/wp-json\/wp\/v2\/tags?post=2579"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}