45 if (size > std::numeric_limits<size_t>::max() / 2)
54 if (size > std::numeric_limits<size_t>::max() -
sizeof(
Block))
106bool Arena::Block::debugIsValid(
const void*
ptr)
const {
107 return _blockBegin <=
ptr &&
ptr < _freeBegin;
void nameFactoryRegister(NameFactory< AbstractProduct > &factory)
Registers the string returned by ConcreteProduct::getStaticName() to a function that default-construc...
This is an arena allocator.
struct Arena::Block _block
void freeAndAllAfterFromOldBlock(void *ptr)
As Arena::freeAndAllAfter where ptr was allocated from an old block.
static Arena _scratchArena
void discardPreviousBlock()
Free the memory for the previous block.
void freeTopFromOldBlock(void *ptr)
As Arena::freeTop where ptr was allocated from an old block.
void growCapacity(size_t needed)
Allocate a new block with at least needed bytes.
static const size_t MemoryAlignment
The alignment that memory allocators must ensure.
bool hasPreviousBlock() const
Block * _previousBlock
one past last byte (aligned)
char * _blockEnd
pointer to first free byte (aligned)
char * _freeBegin
beginning of current block (aligned)
bool isInBlock(const void *ptr) const