Add a memory reporter for the nsAtomTable

RESOLVED FIXED in mozilla12



7 years ago
7 years ago


(Reporter: njn, Assigned: njn)



Firefox Tracking Flags

(Not tracked)


(Whiteboard: [MemShrink])


(3 attachments)



7 years ago
DMD says it's reasonable prominent:

 Unreported: 1 block(s) in record 9 of 17967
  262,144 bytes (262,144 requested / 0 slop) 
  0.25% of the heap (7.19% cumulative unreported)
    at 0x402A063: malloc (vg_replace_malloc.c:263)
    by 0x403C0A4: moz_malloc (mozalloc.cpp:113)
    by 0x7A4126C: PL_DHashAllocTable (pldhash.cpp:114)
    by 0x7A41AAB: ChangeTable(PLDHashTable*, int) (pldhash.cpp:564)
    by 0x7A41D26: PL_DHashTableOperate (pldhash.cpp:649)
    by 0x7A565D9: GetAtomHashEntry(unsigned short const*, unsigned int) (nsAtomT
    by 0x7A56A0F: NS_NewAtom(nsAString_internal const&) (nsAtomTable.cpp:534)
    by 0x68B4D95: do_GetAtom(nsAString_internal const&) (nsIAtom.h:199)

That's just the hash table storage, which I'm sure can get substantially bigger with more browsing.  There's also the AtomImpls pointed to by the hash table entries, and then the strings hanging off the AtomImpls, but I'll need to look more closely to see if they actually belong to the AtomImpls.

Comment 1

7 years ago
Created attachment 583974 [details] [diff] [review]
patch 1

This patch just adds nsStringBuffer::SizeOfIncludingThisIfUnshared(), which the next patch will use.
Attachment #583974 - Flags: review?(khuey)

Comment 2

7 years ago
Created attachment 583975 [details] [diff] [review]
patch 2

This adds the "explicit/atom-table" memory reporter.  With Gmail and
TechCrunch open it's just over 1MB worth.

I created EnsureTableExists() for an earlier version where I registered the
memory reporter in nsAtomTable.cpp.  That ended up having to change, but I
left EnsureTableExists() in because I think it's an improvement.
Attachment #583975 - Flags: review?(khuey)

Comment 3

7 years ago
Created attachment 583977 [details] [diff] [review]
patch 3

This patch moves AtomImpl and PermanentAtomImpl out of the header, because they don't need to be there.
Attachment #583977 - Flags: review?(khuey)
Comment on attachment 583977 [details] [diff] [review]
patch 3

Review of attachment 583977 [details] [diff] [review]:

Why do we want this?
Comment on attachment 583977 [details] [diff] [review]
patch 3

Review of attachment 583977 [details] [diff] [review]:

Ok, I guess hiding these is fine.
Attachment #583977 - Flags: review?(khuey) → review+

Comment 6

7 years ago
> Why do we want this?

Basic information hiding, that's all.  I just figured I'd fix it while I was in the area.
Last Resolved: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla12
You need to log in before you can comment on or make changes to this bug.