|
LLVM 24.0.0git
|
PerThreadAllocator wraps a thread-unsafe allocator (e.g. More...
#include "llvm/Support/PerThreadBumpPtrAllocator.h"
Public Member Functions | |
| PerThreadAllocator () | |
| void * | Allocate (size_t Size, size_t Alignment) |
| Allocate Size bytes of Alignment aligned memory. | |
| void | Deallocate (const void *Ptr, size_t Size, size_t Alignment) |
| Deallocate Ptr to Size bytes of memory allocated by this allocator. | |
| AllocatorTy & | getThreadLocalAllocator () |
| Return the calling thread's sub-allocator, creating it on first use. | |
| size_t | getNumberOfAllocators () const |
| Return the number of sub-allocators, i.e. threads that have allocated. | |
| void | Reset () |
| Reset state of allocators. | |
| size_t | getTotalMemory () const |
| Return total memory size used by all allocators. | |
| void | setRedZoneSize (size_t NewSize) |
| Set red zone for all allocators. | |
| void | PrintStats () const |
| Print statistic for each allocator. | |
| Public Member Functions inherited from llvm::AllocatorBase< PerThreadAllocator< AllocatorTy > > | |
| void * | Allocate (size_t Size, size_t Alignment) |
| Allocate Size bytes of Alignment aligned memory. | |
| void | Deallocate (const void *Ptr, size_t Size, size_t Alignment) |
| Deallocate Ptr to Size bytes of memory allocated by this allocator. | |
Protected Attributes | |
| std::unique_ptr< State > | S |
| unsigned | Id |
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.
Definition at line 34 of file PerThreadBumpPtrAllocator.h.
|
inline |
Definition at line 43 of file PerThreadBumpPtrAllocator.h.
|
protected |
Definition at line 133 of file PerThreadBumpPtrAllocator.h.
|
protected |
Definition at line 132 of file PerThreadBumpPtrAllocator.h.