 |
ATLAS Offline Software
|
Go to the documentation of this file.
61 m_freeptr (
other.m_freeptr)
65 other.m_freeptr =
nullptr;
73 ArenaHeapAllocator::operator=
78 m_freeptr =
other.m_freeptr;
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());
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) {
const Params & params() const
Return this Allocator's parameters.
JetConstituentVector::iterator iterator
ArenaBlock * m_blocks
The list of blocks currently in use.
Exception — Attempt to change memory protection failed.
pointer index(size_t i)
Return a pointer to element i in the block.
ArenaBlock * getBlock()
Return an empty block, either newly-allocated or from the free list.
static void applyList(ArenaBlock *p, func_t *func, size_t n)
Call a function on elements in a list of blocks.
Params m_params
The parameters for this allocator.
size_t eltSize() const
Return the size of the elements in the block.
virtual void erase() override
Free all allocated elements and release memory back to the system.
size_t free
Number of items currently not allocated by the application but cached by the allocator.
func_t * clear
Clear function for elements.
bool m_protected
Flag whether the arena has been protected.
static void appendList(ArenaBlock **headp, ArenaBlock *tail)
Concatenate two lists of blocks.
size_t inuse
Number of items currently allocated by the application.
Stat blocks
Counts of blocks.
void func_t(pointer)
Type of functions for constructor, etc.
void slowClear()
Call clear() for all allocated elements.
size_t size() const
Return the number of elements in the block.
virtual void erase() override final
Free all allocated elements and release memory back to the system.
void swap(ArenaHeapAllocator &other)
Swap.
virtual void reset() override
Free all allocated elements.
void eraseUnprotected()
Free all allocated elements and release memory back to the system.
Common functionality for block-oriented allocators.
A large memory block that gets carved into smaller uniform elements.
ArenaBlockAllocatorBase & operator=(const ArenaBlockAllocatorBase &)=delete
pointer m_freeptr
Pointer to the next free element.
size_t total
Total number of items held by the allocator.
ArenaAllocatorBase::Stats m_stats
The statistics structure.
size_t linkOffset
Offset from the start of a free element to a pointer to be used by the allocator.
void unprotect()
Write-enable the memory managed by this allocator.
bool canReclear
If true, clear can be called more than once on a given element.
void swap(ArenaBlockAllocatorBase &other)
Swap.
ArenaBlock * m_freeblocks
The list of free blocks.
size_t eltSize
The size in bytes of the individual elements we're allocating.
char * pointer
Type for pointers to elements.
pointer refill()
Add more free elements to the pool, and allocate a new element.
Exceptions that can be thrown from AthAllocators.
ArenaHeapAllocator(const Params ¶ms)
Constructor.
pointer & link(pointer p) const
Return a reference to the link for an element.
Heap-based allocator. See Arena.h for an overview of the arena-based memory allocators.
A large memory block that gets carved into smaller uniform elements. See Arena.h for an overview of t...
Stat elts
Counts of elements.
virtual ~ArenaHeapAllocator()
Destructor.