Closed
Bug 1026985
Opened 11 years ago
Closed 11 years ago
Stop reporting the memory use of nsAttrValue's MiscContainer objects if they are shared
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
FIXED
mozilla33
People
(Reporter: jwatt, Assigned: jwatt)
References
Details
(Whiteboard: [MemShrink])
Attachments
(2 files)
11.21 KB,
text/plain
|
Details | |
1.29 KB,
patch
|
bzbarsky
:
review+
|
Details | Diff | Splinter Review |
I'm seeing a single twice-reported entry in a DMD report. In that entry the "Reported at" and "Reported again at" stacks are identical. From code inspection I can't see how that is possible.
![]() |
Assignee | |
Comment 1•11 years ago
|
||
![]() |
Assignee | |
Comment 2•11 years ago
|
||
This happened when I ran Firefox with the -layoutdebug command line argument, then loaded:
http://www.w3schools.com/CSSref/tryit.asp?filename=trycss_gen_counter-reset
before triggering DMD's report.
![]() |
Assignee | |
Comment 3•11 years ago
|
||
Consider the stack:
WindowsMallocSizeOf
nsAttrValue::SizeOfExcludingThis
nsAttrAndChildArray::SizeOfExcludingThis
mozilla::dom::FragmentOrElement::SizeOfExcludingThis
nsINode::SizeOfIncludingThis
nsDocument::DocAddSizeOfExcludingThis
nsHTMLDocument::DocAddSizeOfExcludingThis
We can be pretty sure that nsDocument::DocAddSizeOfExcludingThis is not being called twice since if it was we'd be getting much more than just the single twice-reported entry.
nsDocument::DocAddSizeOfExcludingThis is clearly at this line when nsINode::SizeOfIncludingThis is called:
https://mxr.mozilla.org/mozilla-central/source/content/base/src/nsDocument.cpp?rev=72961f73cb4a#11955
and that section of code can't be creating a duplicate report - if the nsINode was in the child list twice then the nsINode itself would also appear as twice-reported.
nsINode::SizeOfIncludingThis also doesn't seem to be responsible since it just does |aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf)|.
FragmentOrElement::SizeOfExcludingThis calls mAttrsAndChildren.SizeOfExcludingThis() only once, and nsAttrValue::SizeOfExcludingThis only calls aMallocSizeOf() once on the MiscContainer that is being double reported.
Comment 5•11 years ago
|
||
This is probably a bug in the memory reporter (not DMD) where a shared MiscContainer is actually being twice reported. A comment in |nsAttrValue::ClearMiscContainer| implies that MiscContainers can be shared [1]. I haven't completely traced through, but it looks like two nsAttrAndChildArrays are sharing a MiscContainer.
[1] http://dxr.mozilla.org/mozilla-central/source/content/base/src/nsAttrValue.cpp#1768
![]() |
Assignee | |
Comment 6•11 years ago
|
||
You're right. I should have spotted that, thanks!
Summary: Something may be rotten in DMD's twice-reported entries → Stop reporting the memory use of nsAttrValue's MiscContainer objects if they are shared
![]() |
Assignee | |
Comment 7•11 years ago
|
||
Assignee: nobody → jwatt
Attachment #8442235 -
Flags: review?(bzbarsky)
Flags: needinfo?(n.nethercote)
Updated•11 years ago
|
Component: DMD → DOM
Whiteboard: [MemShrink]
![]() |
||
Comment 8•11 years ago
|
||
Thanks for spotting, erahm!
![]() |
||
Comment 9•11 years ago
|
||
Comment on attachment 8442235 [details] [diff] [review]
patch
r=me
Attachment #8442235 -
Flags: review?(bzbarsky) → review+
![]() |
Assignee | |
Comment 10•11 years ago
|
||
Comment 11•11 years ago
|
||
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla33
Updated•6 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•