65 other.m_freeptr =
nullptr;
73ArenaHeapAllocator::operator=
79 other.m_freeptr =
nullptr;
156 size_t sz = newblock->
size();
157 size_t elt_size = newblock->
eltSize();
158 for (
size_t i=1; i <
sz; i++) {
167 return newblock->
index (0, elt_size);
177 std::vector<pointer> free_ptrs;
180 free_ptrs.push_back (p);
182 std::sort (free_ptrs.begin(), free_ptrs.end());
185 std::vector<ArenaBlock*> blocks;
187 blocks.push_back (p);
189 std::sort (blocks.begin(), blocks.end());
194 std::vector<pointer>::iterator
pi = free_ptrs.begin();
195 std::vector<pointer>::iterator pi_end = free_ptrs.end();
196 std::vector<ArenaBlock*>::iterator bi = blocks.begin();
197 std::vector<ArenaBlock*>::iterator bi_end = blocks.end();
199 for (; bi != bi_end; ++bi) {
202 size_t elt_size = bl.
eltSize();
203 for (
size_t i = 0; i <
sz; i++) {
205 if (
pi != pi_end && ptr == *
pi) {
A large memory block that gets carved into smaller uniform elements. See Arena.h for an overview of t...
Heap-based allocator. See Arena.h for an overview of the arena-based memory allocators.
Exceptions that can be thrown from AthAllocators.
char * pointer
Type for pointers to elements.
void func_t(pointer)
Type of functions for constructor, etc.
void unprotect()
Write-enable the memory managed by this allocator.
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.
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.
ArenaBlock * m_blocks
The list of blocks currently in use.
Params m_params
The parameters for 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.
pointer index(size_t i)
Return a pointer to element i in the block.
size_t eltSize() const
Return the size of the elements in the block.
static void appendList(ArenaBlock **headp, ArenaBlock *tail)
Concatenate two lists of blocks.
size_t size() const
Return the number of elements in the block.
static void applyList(ArenaBlock *p, func_t *func, size_t n)
Call a function on elements in a list of blocks.
virtual ~ArenaHeapAllocator()
Destructor.
void swap(ArenaHeapAllocator &other)
Swap.
pointer refill()
Add more free elements to the pool, and allocate a new element.
void slowClear()
Call clear() for all allocated elements.
pointer m_freeptr
Pointer to the next free element.
pointer & link(pointer p) const
Return a reference to the link for an element.
virtual void erase() override final
Free all allocated elements and release memory back to the system.
virtual void reset() override
Free all allocated elements.
ArenaHeapAllocator(const Params ¶ms)
Constructor.
Exception — Attempt to change memory protection failed.
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.
void swap(ElementLinkVector< DOBJ > &lhs, ElementLinkVector< DOBJ > &rhs)