13#ifndef ATHALLOCATORS_ARENABLOCKALLOCATORBASE_H
14#define ATHALLOCATORS_ARENABLOCKALLOCATORBASE_H
92 virtual void reserve (
size_t size)
override;
103 virtual void erase()
override;
115 virtual const std::string&
name()
const override;
Common base class for arena allocator classes. See Arena.h for an overview of the arena-based memory ...
Common base class for arena allocator classes.
virtual void reserve(size_t size) override
Set the total number of elements cached by the allocator.
void unprotect()
Write-enable the memory managed by this allocator.
ArenaBlockAllocatorBase(const ArenaBlockAllocatorBase &)=delete
Don't allow copy construction or assignment.
const Params & params() const
Return this Allocator's parameters.
ArenaBlock * getBlock()
Return an empty block, either newly-allocated or from the free list.
ArenaBlockAllocatorBase & operator=(const ArenaBlockAllocatorBase &)=delete
virtual void erase() override
Free all allocated elements and release memory back to the system.
virtual ~ArenaBlockAllocatorBase()
Destructor.
void eraseUnprotected()
Free all allocated elements and release memory back to the system.
ArenaAllocatorBase::Stats m_stats
The statistics structure.
void swap(ArenaBlockAllocatorBase &other)
Swap.
ArenaBlockAllocatorBase(const Params ¶ms)
Constructor.
void protect()
Write-protect the memory managed by this allocator.
ArenaBlock * m_blocks
The list of blocks currently in use.
virtual Stats stats() const override
Return the statistics block for this allocator.
Params m_params
The parameters for this allocator.
virtual const std::string & name() const override
Return the name of this allocator.
ArenaBlock * m_freeblocks
The list of free blocks.
bool m_protected
Flag whether the arena has been protected.
A large memory block that gets carved into smaller uniform elements.
Statistics for an allocator.