|
| | BumpPtrAllocatorImpl ()=default |
| template<typename T> |
| | BumpPtrAllocatorImpl (T &&Allocator) |
| | BumpPtrAllocatorImpl (BumpPtrAllocatorImpl &&Old) |
| | ~BumpPtrAllocatorImpl () |
| BumpPtrAllocatorImpl & | operator= (BumpPtrAllocatorImpl &&RHS) |
| void | Reset () |
| | Deallocate all but the current slab and reset the current pointer to the beginning of it, freeing all memory allocated so far.
|
| LLVM_ATTRIBUTE_RETURNS_NONNULL void * | Allocate (size_t Size, Align Alignment) |
| | Allocate space at the specified alignment.
|
| LLVM_ATTRIBUTE_RETURNS_NONNULL LLVM_ATTRIBUTE_NOINLINE void * | AllocateSlow (size_t Size, size_t SizeToAllocate, Align Alignment) |
| LLVM_ATTRIBUTE_RETURNS_NONNULL void * | Allocate (size_t Size, size_t Alignment) |
| void | Deallocate (const void *Ptr, size_t Size, size_t) |
| size_t | GetNumSlabs () const |
| std::optional< int64_t > | identifyObject (const void *Ptr) |
| int64_t | identifyKnownObject (const void *Ptr) |
| | A wrapper around identifyObject that additionally asserts that the object is indeed within the allocator.
|
| template<typename T> |
| int64_t | identifyKnownAlignedObject (const void *Ptr) |
| | A wrapper around identifyKnownObject.
|
| size_t | getTotalMemory () const |
| void | setRedZoneSize (size_t NewSize) |
| void | PrintStats () const |
| 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.
|
template<typename AllocatorT = MallocAllocator,
size_t SlabSize = 4096,
size_t SizeThreshold = SlabSize,
size_t GrowthDelay = 128,
size_t MinAlign = 8>
class llvm::BumpPtrAllocatorImpl< AllocatorT, SlabSize, SizeThreshold, GrowthDelay, MinAlign >
Allocate memory in an ever growing pool, as if by bump-pointer.
This isn't strictly a bump-pointer allocator as it uses backing slabs of memory rather than relying on a boundless contiguous heap. However, it has bump-pointer semantics in that it is a monotonically growing pool of memory where every allocation is found by merely allocating the next N bytes in the slab, or the next N bytes in the next slab.
Note that this also has a threshold for forcing allocations above a certain size into their own slab.
The BumpPtrAllocatorImpl template defaults to using a MallocAllocator object, which wraps malloc, to allocate memory, but it can be changed to use a custom allocator.
The GrowthDelay specifies after how many allocated slabs the allocator increases the size of the slabs.
MinAlign keeps the bump pointer aligned between allocations: each size is rounded up to a multiple of MinAlign so the fast path can skip realigning CurPtr when the requested alignment is no greater than MinAlign.
Definition at line 68 of file Allocator.h.