GCChunk.chunk

A chunk of elements

Members

Functions

allocateFromFree
T* allocateFromFree()

Allocate a T* from the free list.

deallocate
bool deallocate(T* t)

deallocate a T*, send it to the free list

Variables

elems
T[chunkSize] 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