ATLAS Offline Software
|
STL-style allocator wrapper for ArenaHeapAllocator
allowing the heap to be shared between containers.
More...
#include "AthAllocators/ArenaHeapAllocator.h"
#include "AthAllocators/ArenaHeapSTLAllocator.h"
#include "AthAllocators/ArenaAllocatorRegistry.h"
#include "CxxUtils/concepts.h"
#include <string>
#include <vector>
#include "AthAllocators/ArenaSharedHeapSTLAllocator.icc"
Go to the source code of this file.
Classes | |
class | SG::ArenaSharedHeapSTLAllocator< T > |
Forward declaration. More... | |
class | SG::ArenaSharedHeapSTLHeader |
Common header class for ArenaSharedHeapSTLAllocator. More... | |
class | SG::ArenaSharedHeapSTLAllocator< T > |
Forward declaration. More... | |
struct | SG::ArenaSharedHeapSTLAllocator< T >::rebind< U > |
Standard STL allocator rebinder. More... | |
Namespaces | |
SG | |
Forward declaration. | |
Functions | |
template<class T > | |
void | SG::swap (ArenaSharedHeapSTLAllocator< T > &a, ArenaSharedHeapSTLAllocator< T > &b) |
template<class T > | |
void | SG::maybeUnprotect (ArenaSharedHeapSTLAllocator< T > &a) |
Hook for unprotecting an arena. More... | |
STL-style allocator wrapper for ArenaHeapAllocator
allowing the heap to be shared between containers.
T
with the following special properties.ArenaHeapAllocator
for allocations.So, this allocator is suitable for an STL container which allocates lots of fixed-size objects, such as std::list
, and further, you want to be able to have multiple list instances use the same pool.
Note that this allocator will not work for containers that make variable-sized allocations, such as vector and the hash table containers.
To use it, you should first explicitly create the allocator class, and then pass it to the constructors of the containers. The memory pool will be deleted when the original allocator instance is deleted. Example:
Implementation: Each allocator references a Header object, which is common to all allocators in the pool. When an allocator is copied, the header pointer is copied too. The Header object remembers the address of the allocator which originally created it, so that we can clean things up when that allocator goes away.
A Header contains a list of ArenaHeapAllocator objects, one per payload type. We use ArenaAllocatorRegistry to assign indices to the different allocator types.
Definition in file ArenaSharedHeapSTLAllocator.h.