parserino.arena
A bump allocator: many small allocations, freed all together.
It also works at compile time (CTFE), where it falls back to the GC, so the same parsing code can run both at runtime and at compile time.
Types 2
structArena
The bump allocator: memory comes from zeroed blocks (4 KB, doubling up to 16 KB, or bigger for a bigger allocation) that are freed all together by release or the destructor. An Arena can't be copied.
Methods
T[] alloc(T)(size_t n) @nogc nothrow pure @safe @trustedAllocate `n` zeroed `T`s. It returns `null` if out of memory.void reserve(size_t bytes) @nogc nothrow pure @safe @trustedMake room for `bytes` more bytes in a single block (when the total is known in advance)size_t allocated() @nogc nothrow pure @safe const @trustedThe bytes taken from the system (all the blocks, used or not)Destructors
Nested Templates
BlockstructBuffer(T)
A growable array for temporary data (malloc'd, GC in CTFE). If memory runs out, the items are not added and failed becomes true (and stays true): the owner checks it at the end of its work, as it checks the results of the Arena.
Fields
bool failedMemory ran out: some items were not addedMethods
inout(T)[] opSlice() @nogc nothrow pure @safe inoutThe items (a slice of the buffer: valid until the next `put`)Destructors