Closed
Bug 674284
Opened 13 years ago
Closed 13 years ago
Add nsTArray::SizeOf
Categories
(Core :: XPCOM, defect)
Tracking
()
RESOLVED
FIXED
mozilla8
People
(Reporter: khuey, Assigned: khuey)
Details
(Whiteboard: [MemShrink])
Attachments
(1 file)
794 bytes,
patch
|
benjamin
:
review+
|
Details | Diff | Splinter Review |
For about:memory reporting usage.
Attachment #548525 -
Flags: review?(benjamin)
Updated•13 years ago
|
Attachment #548525 -
Flags: review?(benjamin) → review+
Assignee | ||
Comment 1•13 years ago
|
||
Status: NEW → RESOLVED
Closed: 13 years ago
Flags: in-testsuite-
Resolution: --- → FIXED
Target Milestone: --- → mozilla8
Comment 2•13 years ago
|
||
this has been backed out
http://hg.mozilla.org/mozilla-central/rev/9517e7652dec
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Updated•13 years ago
|
Whiteboard: [MemShrink]
Comment 3•13 years ago
|
||
Comment on attachment 548525 [details] [diff] [review]
Patch
>+ // @return The amount of memory taken used by this nsTArray, not including
>+ // sizeof(this)
>+ size_t SizeOf() const {
>+ return Capacity() * sizeof(elem_type) + sizeof(mHdr);
Except the mHdr is shared between non-auto nsTArrays...
Assignee | ||
Comment 4•13 years ago
|
||
(In reply to comment #3)
> Comment on attachment 548525 [details] [diff] [review] [diff] [details] [review]
> Patch
>
> >+ // @return The amount of memory taken used by this nsTArray, not including
> >+ // sizeof(this)
> >+ size_t SizeOf() const {
> >+ return Capacity() * sizeof(elem_type) + sizeof(mHdr);
> Except the mHdr is shared between non-auto nsTArrays...
That's only true if the nsTArray is empty, no?
Assignee | ||
Comment 5•13 years ago
|
||
Comment on attachment 548525 [details] [diff] [review]
Patch
This bounced with
../../../dist/include/nsTArray.h: In member function 'size_t nsTArray<E, Alloc>::SizeOf() const':
../../../dist/include/nsTArray.h:436:21: error: there are no arguments to 'Capacity' that depend on a template parameter, so a declaration of 'Capacity' must be available
../../../dist/include/nsTArray.h:436:21: note: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated)
../../../dist/include/nsTArray.h:436:52: error: 'mHdr' was not declared in this scope
Not quite sure what to make of these ... it looks like base class members aren't in scope?
Comment 6•13 years ago
|
||
You need this->Capacity. Bare names are not in scope in template classes that inherit from other templated classes. C++ is weird like that.
Assignee | ||
Comment 7•13 years ago
|
||
Added the 'this' qualifiers.
http://hg.mozilla.org/mozilla-central/rev/bd93ca20e1fd
Assignee: nobody → khuey
Status: REOPENED → RESOLVED
Closed: 13 years ago → 13 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•