Concurrent wrapper that gives each thread its own sub‐allocator.
Synopsis
Declared in <llvm/Support/PerThreadBumpPtrAllocator.h>
template<typename AllocatorTy>
class PerThreadAllocator
: public AllocatorBase<PerThreadAllocator<AllocatorTy>>
Description
PerThreadAllocator wraps a thread‐unsafe allocator (e.g. BumpPtrAllocator) for lock‐free concurrent allocation: each thread receives its own sub‐allocator on first allocation, and the PerThreadAllocator owns all sub‐allocators. Recommended to used with the thread pool in Parallel.h even if there is no dependency on it.
Base Classes
Name |
Description |
CRTP base class providing obvious overloads for the core |
Member Functions
Name |
Description |
|
Construct an empty per‐thread allocator with a fresh instance id. |
|
|
|
|
Print statistic for each allocator. |
|
Reset state of allocators. |
|
Return the number of sub‐allocators, i.e. threads that have allocated. |
|
Return the calling thread's sub‐allocator, creating it on first use. |
|
Return total memory size used by all allocators. |
|
Set red zone for all allocators. |
Using Declarations
Name |
Description |
Bring AllocatorBase typed Allocate overloads into scope. |
|
Bring AllocatorBase typed Deallocate overloads into scope. |