Closed Bug 674284 Opened 13 years ago Closed 13 years ago

Add nsTArray::SizeOf

Categories

(Core :: XPCOM, defect)

x86
Windows 7
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla8

People

(Reporter: khuey, Assigned: khuey)

Details

(Whiteboard: [MemShrink])

Attachments

(1 file)

Attached patch PatchSplinter Review
For about:memory reporting usage.
Attachment #548525 - Flags: review?(benjamin)
Attachment #548525 - Flags: review?(benjamin) → review+
Status: NEW → RESOLVED
Closed: 13 years ago
Flags: in-testsuite-
Resolution: --- → FIXED
Target Milestone: --- → mozilla8
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Whiteboard: [MemShrink]
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...
(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?
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?
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: nobody → khuey
Status: REOPENED → RESOLVED
Closed: 13 years ago13 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: