Last Comment Bug 655638 - Negative values for "heap-used/other" in about:memory due to overlap between image and canvas memory reporters
: Negative values for "heap-used/other" in about:memory due to overlap between ...
Status: RESOLVED FIXED
:
Product: Toolkit
Classification: Components
Component: General (show other bugs)
: unspecified
: All All
: -- normal (vote)
: ---
Assigned To: Nicholas Nethercote [:njn]
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-05-08 19:10 PDT by Nicholas Nethercote [:njn]
Modified: 2011-05-11 21:04 PDT (History)
2 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
patch (1.16 KB, patch)
2011-05-09 20:53 PDT, Nicholas Nethercote [:njn]
bas: review+
Details | Diff | Review

Description Nicholas Nethercote [:njn] 2011-05-08 19:10:17 PDT
While running www.thewildernessdowntown.com I saw this about:memory?verbose report:

Used Heap Memory
318,096,000 B (100.0%) -- heap-used
├──143,534,760 B (45.12%) -- content
│  └──143,534,760 B (45.12%) -- canvas
│     └──143,534,760 B (45.12%) -- 2d-pixel-bytes
├──117,853,666 B (37.05%) -- images
│  ├──117,632,046 B (36.98%) -- content
│  │  ├──117,632,046 B (36.98%) -- used
│  │  │  ├──109,251,088 B (34.35%) -- uncompressed
│  │  │  └────8,380,958 B (02.63%) -- raw
│  │  └────────────0 B (00.00%) -- unused
│  │               ├──0 B (00.00%) -- raw
│  │               └──0 B (00.00%) -- uncompressed
│  └──────221,620 B (00.07%) -- chrome
│         ├──221,620 B (00.07%) -- used
│         │  ├──221,620 B (00.07%) -- uncompressed
│         │  └────────0 B (00.00%) -- raw
│         │  ├──221,620 B (00.07%) -- uncompressed
│         │  └────────0 B (00.00%) -- raw
│         └────────0 B (00.00%) -- unused
│                  ├──0 B (00.00%) -- raw
│                  └──0 B (00.00%) -- uncompressed
├───82,941,384 B (26.07%) -- js
│   ├──80,740,352 B (25.38%) -- gc-heap
│   ├───1,188,336 B (00.37%) -- tjit-data
│   │   └──1,188,336 B (00.37%) -- allocators
│   │      ├────888,000 B (00.28%) -- reserve
│   │      └────300,336 B (00.09%) -- main
│   └───1,012,696 B (00.32%) -- mjit-data
├────3,208,944 B (01.01%) -- storage
│    └──3,208,944 B (01.01%) -- sqlite
│       ├──2,150,264 B (00.68%) -- places.sqlite
│       │  ├──1,884,568 B (00.59%) -- cache-used
│       │  ├────188,104 B (00.06%) -- stmt-used
│       │  └─────77,592 B (00.02%) -- schema-used
│       ├────610,576 B (00.19%) -- other
│       ├────214,304 B (00.07%) -- urlclassifier3.sqlite
│       │    ├──109,120 B (00.03%) -- cache-used
│       │    ├──100,944 B (00.03%) -- stmt-used
│       │    └────4,240 B (00.00%) -- schema-used
│       ├────146,992 B (00.05%) -- cookies.sqlite
│       │    ├──131,520 B (00.04%) -- cache-used
│       │    ├───12,528 B (00.00%) -- stmt-used
│       │    └────2,944 B (00.00%) -- schema-used
│       ├─────29,720 B (00.01%) -- formhistory.sqlite
│       │     ├──22,736 B (00.01%) -- stmt-used
│       │     ├───4,328 B (00.00%) -- cache-used
│       │     └───2,656 B (00.00%) -- schema-used
│       ├─────21,808 B (00.01%) -- content-prefs.sqlite
│       │     └───2,656 B (00.00%) -- schema-used
│       ├─────21,808 B (00.01%) -- content-prefs.sqlite
│       │     ├───9,632 B (00.00%) -- stmt-used
│       │     ├───8,152 B (00.00%) -- cache-used
│       │     └───4,024 B (00.00%) -- schema-used
│       ├─────13,848 B (00.00%) -- downloads.sqlite
│       │     ├───6,704 B (00.00%) -- stmt-used
│       │     ├───4,320 B (00.00%) -- cache-used
│       │     └───2,824 B (00.00%) -- schema-used
│       ├─────13,160 B (00.00%) -- permissions.sqlite
│       │     ├───6,776 B (00.00%) -- stmt-used
│       │     ├───4,328 B (00.00%) -- cache-used
│       │     └───2,056 B (00.00%) -- schema-used
│       └──────8,272 B (00.00%) -- search.sqlite
│              ├──4,312 B (00.00%) -- cache-used
│              ├──2,000 B (00.00%) -- schema-used
│              └──1,960 B (00.00%) -- stmt-used
├────1,236,113 B (00.39%) -- layout
│    ├──1,236,113 B (00.39%) -- all
│    └──────────0 B (00.00%) -- bidi
├──────177,276 B (00.06%) -- gfx
│      └──177,276 B (00.06%) -- surface
│         └──177,276 B (00.06%) -- image
└──-30,856,143 B (-9.70%) -- other

"heap-used/other" is negative, which indicates that some of the heap-used reporters are overlapping.  I bet that "content/canvas/2d-pixel-bytes" and "images/content/used", the two biggest numbers here, are the culprits.
Comment 1 Nicholas Nethercote [:njn] 2011-05-08 19:41:10 PDT
I talked with Bas about this on IRC.  He thinks that "images/content/used" and "content/canvas/2d-pixel-bytes" can overlap.  He also thinks that "content/canvas/2d-pixel-bytes" can be in VRAM, on Windows at least.  Both of those points sound like arguments for moving content/canvas/2d-pixel-bytes out of the "Used Heap" tree into the "Other Measurements" list.
Comment 2 Nicholas Nethercote [:njn] 2011-05-09 20:53:51 PDT
Created attachment 531237 [details] [diff] [review]
patch

Trivial patch.
Comment 3 Bas Schouten (:bas.schouten) 2011-05-09 20:58:39 PDT
Comment on attachment 531237 [details] [diff] [review]
patch

Review of attachment 531237 [details] [diff] [review]:
-----------------------------------------------------------------

Looks good in general, only a small comment.

::: content/canvas/src/nsCanvasRenderingContext2D.cpp
@@ +173,5 @@
>  }
>  
> +// This isn't "heap-used/content/canvas/2d-pixel-bytes" because it overlaps
> +// with "heap-used/images/content/used", and so has to go in the "Other
> +// Measurements" section of about:memory.  See bug 655638 for details.

Are we sure that's actually what it overlaps with? It can also simply not be on the heap for example (but in VRAM), I'd rather say something like: "This isn't "heap-used/content/canvas/2d-pixel-bytes" because the pixels of a canvas do not necessarily exist on the heap. And if they do, should be tracked by underlying surface implementations. See bug 655638 for details."
Comment 4 Nicholas Nethercote [:njn] 2011-05-10 00:07:02 PDT
(In reply to comment #3)
>
> "This
> isn't "heap-used/content/canvas/2d-pixel-bytes" because the pixels of a
> canvas do not necessarily exist on the heap. And if they do, should be
> tracked by underlying surface implementations. See bug 655638 for details."

I'll update, thanks!
Comment 5 Nicholas Nethercote [:njn] 2011-05-11 21:04:53 PDT
http://hg.mozilla.org/mozilla-central/rev/5ba52131c1a2

Note You need to log in before you can comment on or make changes to this bug.