gecko-dev/xpcom/ds/nsAtomTable.h
Nicholas Nethercote 60b1f563cb 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.

--HG--
extra : rebase_source : ba4065ea31e509dd985c003614199f73def0596c
2018-06-22 09:38:42 +10:00

33 lines
795 B
C++

/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef nsAtomTable_h__
#define nsAtomTable_h__
#include "mozilla/MemoryReporting.h"
#include <stddef.h>
void NS_InitAtomTable();
void NS_ShutdownAtomTable();
namespace mozilla {
struct AtomsSizes
{
size_t mTable;
size_t mDynamicAtoms;
AtomsSizes()
: mTable(0)
, mDynamicAtoms(0)
{}
};
} // namespace mozilla
void NS_AddSizeOfAtoms(mozilla::MallocSizeOf aMallocSizeOf,
mozilla::AtomsSizes& aSizes);
#endif // nsAtomTable_h__