Container.ChunkGC

GC Chunk allocator

Can save approximately 30% memory for small elements (tested with integer elements and a chunk size of 1000), and is at least twice as fast at adding elements when compared to the generic allocator (approximately 50x faster with LinkedList)

Operates safely with GC managed entities

Members

Functions

allocate
T* allocate()

allocate a T-sized memory chunk

allocate
T*[] allocate(size_t count)

allocate an array of T* sized memory chunks

collect
void collect(T*[] t)

Invoked when a specific T*[] is discarded

collect
void collect(T* p)

Invoked when a specific T is discarded

collect
bool collect(bool all)

Invoked when clear/reset is called on the host. This is a shortcut to clear everything allocated.

config
void config(size_t chunks, size_t allocate)

set the chunk size and prepopulate with nodes

Meta