SimpleAllocatorBlock

class SimpleAllocatorBlock

Bases: LinkedListNode

A single block as returned from SimpleAllocator::alloc().

Inheritance diagram

Inheritance diagram of SimpleAllocatorBlock

void free(void)

Releases the allocated space.

SimpleAllocator *get_allocator(void) const

Returns the SimpleAllocator object that owns this block. Returns NULL if the block has been freed.

std::size_t get_max_size(void) const

Returns the maximum size this block can be reallocated to, as limited by the following block.

SimpleAllocatorBlock *get_next_block(void) const

Returns a pointer to the next allocated block in the chain, or NULL if there are no more allocated blocks.

std::size_t get_size(void) const

Returns the size of this block. It is an error to call this if the block has been freed.

std::size_t get_start(void) const

Returns the starting point of this block. It is an error to call this if the block has been freed.

bool is_free(void) const

Returns true if the block has been freed, false if it is still valid.

void output(std::ostream &out) const
bool realloc(std::size_t size)

Changes the size of this block to the specified size. Returns true if the change is accepted, false if there was not enough room.