ChunkAllocator

Custom non-GC allocator for managing a list of chunks.

Constructors

this
this(size_t size)

Constructs a ChunkAllocator.

Members

Functions

allocate
void* allocate(size_t n)

Returns a pointer to an array of size n bytes.

destroy
void destroy()

Frees all the allocated memory.

getChunk
Array* getChunk(size_t n)

Returns a chunk that can hold another n bytes.

initialize
void initialize(size_t size)

Initializes with one chunk.

lastChunk
Array* lastChunk()

Returns chunk number n.

newChunk
Array* newChunk()

Adds a new chunk to the list and returns it.

Variables

chunks
Array chunks;

List of memory chunks, getting larger progressively.

Meta