memory.allocators

(Hopefully) useful allocators.

Members

Structs

BlockAllocator
struct BlockAllocator(size_t blockSize)

Simple allocator that allocates memory in chucks of blockSize, and then frees all of its blocks when it goes out of scope. The block allocator is reference counted, so it may be copied safely. It does not support freeing any memory allocated by it. Deallocation only occurs by destroying the entire allocator. Note that it is not possible to allocate blockSize bytes with this allocator due to some memory being used for internal record keeping.

Templates

NodeAllocator
template NodeAllocator(size_t nodeSize, size_t blockSize = 1024)

Allocator used for allocating nodes of a fixed size.

QuickAllocator
template QuickAllocator(size_t stackCapacity)

Allocator that performs most small allocations on the stack, then falls over to malloc/free when necessary.

Meta

Authors

Brian Schott