A collection of BlockAllocators binned to size classes.
More...
#include <BinnedAllocator.h>
|
static constexpr size_type | BIN_SIZE_CLASS_0 = 1024 |
|
static constexpr size_type | BIN_SIZE_CLASS_1 = 8 * 1024 |
|
static constexpr size_type | BIN_SIZE_CLASS_2 = 32 * 1024 |
|
static constexpr size_type | BIN_SIZE_CLASS_3 = 512 * 1024 |
|
static constexpr size_type | BIN_IDX_OVERSIZED = UINT32_MAX |
|
static constexpr size_type | BIN_DIVISOR = 4 |
|
|
class | internal::BlockAllocator |
|
◆ ~BinnedAllocator()
gts::BinnedAllocator::~BinnedAllocator |
( |
| ) |
|
Destructs the allocator. Frees all BlockAllocator.
◆ allocate()
void* gts::BinnedAllocator::allocate |
( |
size_t |
size | ) |
|
- Returns
- A block memory of size 'size'.
◆ binCount()
GTS_INLINE size_type gts::BinnedAllocator::binCount |
( |
| ) |
const |
|
inline |
- Returns
- The number of bins.
◆ calculateBin() [1/2]
GTS_INLINE size_type gts::BinnedAllocator::calculateBin |
( |
size_type |
size | ) |
|
|
inline |
- Returns
- The bin 'size' belongs in.
◆ calculateBin() [2/2]
GTS_INLINE size_type gts::BinnedAllocator::calculateBin |
( |
void * |
ptr | ) |
|
|
inline |
- Returns
- The bin 'ptr' belongs to.
◆ deallocate()
void gts::BinnedAllocator::deallocate |
( |
void * |
ptr | ) |
|
◆ getAllAllocators()
- Returns
- A vector of all the binned BlockAllocators.
◆ init()
bool gts::BinnedAllocator::init |
( |
MemoryStore * |
pMemoryStore | ) |
|
Initialize the BinnedSlabAllocator. This must happen before calling allocate.
◆ isInitialized()
GTS_INLINE bool gts::BinnedAllocator::isInitialized |
( |
| ) |
const |
|
inline |
◆ shutdown()
void gts::BinnedAllocator::shutdown |
( |
| ) |
|
Returns all allocated memory back to the OS and checks for memory leaks.
◆ slabCount()
GTS_INLINE size_type gts::BinnedAllocator::slabCount |
( |
size_t |
pageSize | ) |
const |
|
inline |
- Returns
- The total number of Slabs being used for the given page size.