45static constexpr unsigned MALLOC_OVERHEAD =
sizeof(
void *);
49void ForwardAllocator::TEST_recreate_pool()
56ForwardAllocator::ForwardAllocator()
60ForwardAllocator::~ForwardAllocator()
76 head += size -
sizeof(uint64_t);
DynamicPool * mainBufferPool
main buffer pool instance
static Bucket * init(int s,...)
Allocate a Bucket array off of the heap initialized with sizes.
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.
BufferBase * alloc_untyped(size_t size, Executable *flow) override
Get a free item out of the pool.
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.
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.
Class to allow convenient locking and unlocking of mutexes in a C context.
void alloc(Buffer< BufferType > **result, Executable *flow=NULL)
Get a free item out of the pool.
#define HASSERT(x)
Checks that the value of expression x is true, else terminates the current process.