ChunkAllocator.chunk

A chunk of elements

Members

Functions

allocateFromFree
V* allocateFromFree()

Allocate a V* from the free list.

deallocate
bool deallocate(V* v)

deallocate a V*, send it to the free list

Variables

elems
V[elemsPerChunk] elems;

The elements in the chunk.

freeList
element* freeList;

The linked list of free elements in the chunk. This list is amended each time an element in this chunk is freed.

next
chunk* next;

The next chunk in the chain

numFree
uint numFree;

The number of free elements in the freeList. Used to determine whether this chunk can be given back to the GC

prev
chunk* prev;

The previous chunk in the chain. Required for O(1) removal from the chain.

Meta