GTIRB  v2.2.0
GrammaTech Intermediate Representation for Binaries: C++ API
Public Member Functions | Friends | List of all members
gtirb::BumpPtrAllocatorImpl< SlabSize, SizeThreshold > Class Template Reference

#include <Allocator.hpp>

Public Member Functions

 BumpPtrAllocatorImpl ()=default
 
 BumpPtrAllocatorImpl (BumpPtrAllocatorImpl &&Old)
 
 ~BumpPtrAllocatorImpl ()
 
template<typename T >
T * Allocate (size_t Num=1)
 Allocate space for a sequence of objects without constructing them. More...
 
void * Allocate (size_t Size, size_t Alignment)
 Allocate space at the specified alignment. More...
 
void Deallocate (const void *, size_t)
 
size_t getBytesAllocated () const
 
size_t GetNumSlabs () const
 
size_t getTotalMemory () const
 
BumpPtrAllocatorImploperator= (BumpPtrAllocatorImpl &&RHS)
 
void setRedZoneSize (size_t NewSize)
 

Friends

template<typename T >
class SpecificBumpPtrAllocator
 

Detailed Description

template<size_t SlabSize = 4096, size_t SizeThreshold = SlabSize>
class gtirb::BumpPtrAllocatorImpl< SlabSize, SizeThreshold >

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.

Constructor & Destructor Documentation

◆ BumpPtrAllocatorImpl() [1/2]

template<size_t SlabSize = 4096, size_t SizeThreshold = SlabSize>
gtirb::BumpPtrAllocatorImpl< SlabSize, SizeThreshold >::BumpPtrAllocatorImpl ( )
default

◆ BumpPtrAllocatorImpl() [2/2]

template<size_t SlabSize = 4096, size_t SizeThreshold = SlabSize>
gtirb::BumpPtrAllocatorImpl< SlabSize, SizeThreshold >::BumpPtrAllocatorImpl ( BumpPtrAllocatorImpl< SlabSize, SizeThreshold > &&  Old)
inline

◆ ~BumpPtrAllocatorImpl()

template<size_t SlabSize = 4096, size_t SizeThreshold = SlabSize>
gtirb::BumpPtrAllocatorImpl< SlabSize, SizeThreshold >::~BumpPtrAllocatorImpl ( )
inline

Member Function Documentation

◆ Allocate() [1/2]

template<size_t SlabSize = 4096, size_t SizeThreshold = SlabSize>
template<typename T >
T* gtirb::BumpPtrAllocatorImpl< SlabSize, SizeThreshold >::Allocate ( size_t  Num = 1)
inline

Allocate space for a sequence of objects without constructing them.

◆ Allocate() [2/2]

template<size_t SlabSize = 4096, size_t SizeThreshold = SlabSize>
void* gtirb::BumpPtrAllocatorImpl< SlabSize, SizeThreshold >::Allocate ( size_t  Size,
size_t  Alignment 
)
inline

Allocate space at the specified alignment.

◆ Deallocate()

template<size_t SlabSize = 4096, size_t SizeThreshold = SlabSize>
void gtirb::BumpPtrAllocatorImpl< SlabSize, SizeThreshold >::Deallocate ( const void *  ,
size_t   
)
inline

◆ getBytesAllocated()

template<size_t SlabSize = 4096, size_t SizeThreshold = SlabSize>
size_t gtirb::BumpPtrAllocatorImpl< SlabSize, SizeThreshold >::getBytesAllocated ( ) const
inline

◆ GetNumSlabs()

template<size_t SlabSize = 4096, size_t SizeThreshold = SlabSize>
size_t gtirb::BumpPtrAllocatorImpl< SlabSize, SizeThreshold >::GetNumSlabs ( ) const
inline

◆ getTotalMemory()

template<size_t SlabSize = 4096, size_t SizeThreshold = SlabSize>
size_t gtirb::BumpPtrAllocatorImpl< SlabSize, SizeThreshold >::getTotalMemory ( ) const
inline

◆ operator=()

template<size_t SlabSize = 4096, size_t SizeThreshold = SlabSize>
BumpPtrAllocatorImpl& gtirb::BumpPtrAllocatorImpl< SlabSize, SizeThreshold >::operator= ( BumpPtrAllocatorImpl< SlabSize, SizeThreshold > &&  RHS)
inline

◆ setRedZoneSize()

template<size_t SlabSize = 4096, size_t SizeThreshold = SlabSize>
void gtirb::BumpPtrAllocatorImpl< SlabSize, SizeThreshold >::setRedZoneSize ( size_t  NewSize)
inline

Friends And Related Function Documentation

◆ SpecificBumpPtrAllocator

template<size_t SlabSize = 4096, size_t SizeThreshold = SlabSize>
template<typename T >
friend class SpecificBumpPtrAllocator
friend

The documentation for this class was generated from the following file: