Bug 1447951 - Store nsDynamicAtom's chars after the end of the object. r=froydnj
This reduces memory usage because we only need one allocation instead of two for the dynamic atom and its chars, and because we don't need to store a refcount and a size. It precludes sharing of chars between dynamic atoms, but we weren't benefiting much from that anyway. This reduces per-process memory usage by up to several hundred KiB on my Linux64 box. One consequence of this change is that we need to allocate + copy in DOMString::SetKnownLiveAtom(), which could make some things slower.
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
|
||||
nsHtml5AtomEntry::nsHtml5AtomEntry(KeyTypePointer aStr)
|
||||
: nsStringHashKey(aStr)
|
||||
, mAtom(new nsDynamicAtom(*aStr))
|
||||
, mAtom(nsDynamicAtom::Create(*aStr))
|
||||
{
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ nsHtml5AtomEntry::nsHtml5AtomEntry(const nsHtml5AtomEntry& aOther)
|
||||
|
||||
nsHtml5AtomEntry::~nsHtml5AtomEntry()
|
||||
{
|
||||
delete mAtom;
|
||||
nsDynamicAtom::Destroy(mAtom);
|
||||
}
|
||||
|
||||
nsHtml5AtomTable::nsHtml5AtomTable()
|
||||
|
||||
Reference in New Issue
Block a user