37#ifndef _UTILS_FORWARDALLOCATOR_HXX_
38#define _UTILS_FORWARDALLOCATOR_HXX_
60 void *
allocate(
size_t size,
size_t align);
67 static void TEST_recreate_pool();
76 "aligned payload size mismatch");
Base class for all QMember types that hold data in an expandable format.
A specialization of a pool which can allocate new elements dynamically upon request.
An arena allocator, which is optimized to not be able to free individual entries, only the entire all...
void * allocate(size_t size, size_t align)
Allocates a block of memory.
Buffer< AlignedPayload > BufferType
Buffer type that we will be allocating from the pool.
TypedQueue< BufferType > allocatedBlocks_
Holds all blocks that we allocated (ever).
OSMutex lock_
Lock that protects the offset in last variable and the queue of blocks.
size_t offsetInLast_
Points into the last allocated block to the next emtpy space.
static constexpr size_t BLOCK_BYTE_SIZE
Allocated blocks will be this size.
primitive_t AlignedPayload[BLOCK_BYTE_SIZE/sizeof(primitive_t)]
An array type with the BLOCK_BYTE_SIZE size.
size_t allocWasted_
Number of bytes lost due to alignment and end-of-block chunks.
static DynamicPool * kbytePool_
This buffer pool will have one bucket to allocate 1kb objects each and kep them on a free list.
uint64_t primitive_t
A primitive type that has sufficient alignment to what we support.
size_t allocSize_
Total number of bytes allocated.
This class provides a mutex API.
A simple, fast, type-safe single-linked queue class with non-virtual methods.