ddn.data.xml.internal.arena

Internal: simple bump allocator used as an optional per-document arena.

The arena is intended to reduce GC churn when many small strings/nodes are allocated during parsing.

struct XmlArena

Types 1

structXmlArena

A simple growable bump allocator.

Note

This allocator never frees individual allocations. Call reset() to reuse the buffer.
Fields
private char[][] _chunks
private size_t _used
Methods
XmlArena withCapacity(size_t initialCapacity = 4096) @safeCreates an arena with an initial capacity.
void reset() @safe nothrowClears the arena for reuse.
char[] allocate(size_t n) @safeAllocates `n` bytes.
string dup(string value) @safeCopies `value` into the arena.
string assumeImmutable(char[] mem) @trusted