Games Task Scheduler (GTS)
A multi-processor scheduling framework for games engines
|
The header for each Slab. More...
#include <BinnedAllocator.h>
Public Member Functions | |
GTS_INLINE bool | init () const |
bool | empty () const |
void | clear () |
Deallocates all slabs. More... | |
SlabHeader * | allocateSlab (size_t pageSize) |
void | deallocateSlab (SlabHeader *pSlab, bool freeIt) |
PageHeader * | allocatePage (SlabHeader *pSlab, size_t blockSize) |
void | initPage (PageHeader *pPage, size_t pageSize, size_t blockSize) |
void | deallocatePage (PageHeader *pPage) |
Static Public Member Functions | |
static GTS_INLINE SlabHeader * | toSlab (void *ptr) |
static GTS_INLINE PageHeader * | toPage (SlabHeader *pSlab, void *ptr) |
static GTS_INLINE void * | toAlignedBlockStart (PageHeader *pPage, void *ptr) |
static GTS_INLINE size_t | pageSizeToIndex (size_t pageSize) |
Static Public Attributes | |
static constexpr uint32_t | SIZE_DIVISOR = 2 |
static constexpr uint32_t | SLAB_SIZE = (4 * 1024 * 1024) / SIZE_DIVISOR |
The size of a the Slab used for all Page size classes. | |
static constexpr uint32_t | PAGE_SIZE_CLASS_0 = (16 * 1024) / SIZE_DIVISOR |
static constexpr uint32_t | PAGE_SIZE_CLASS_1 = (64 * 1024) / SIZE_DIVISOR |
static constexpr uint32_t | PAGE_SIZE_CLASS_2 = (128 * 1024) / SIZE_DIVISOR |
static constexpr uint32_t | PAGE_SIZE_CLASS_3 = (512 * 1024) / SIZE_DIVISOR |
static constexpr uint32_t | PAGE_FREE_LISTS_COUNT = 5 |
The number of free list, one for each page class size. | |
static const uint32_t | SINGLE_PAGE_HEADER_SIZE |
The needed space for headers when allocating a Slab with a single Page. | |
The header for each Slab.
The header for each Page.
Creates, destroys, and manages Pages and Slabs.
PageHeader* gts::MemoryStore::allocatePage | ( | SlabHeader * | pSlab, |
size_t | blockSize | ||
) |
Commits a page from the Slab and initializes it.
SlabHeader* gts::MemoryStore::allocateSlab | ( | size_t | pageSize | ) |
Allocates a region of memory. Slabs are reserved as 4MiB unless 'pageSize' does not fit.
void gts::MemoryStore::clear | ( | ) |
Deallocates all slabs.
void gts::MemoryStore::deallocatePage | ( | PageHeader * | pPage | ) |
Decommits a Page.
void gts::MemoryStore::deallocateSlab | ( | SlabHeader * | pSlab, |
bool | freeIt | ||
) |
Add a Slab to the free list. Frees Slabs larger than SLAB_SIZE.
bool gts::MemoryStore::empty | ( | ) | const |
void gts::MemoryStore::initPage | ( | PageHeader * | pPage, |
size_t | pageSize, | ||
size_t | blockSize | ||
) |
Initializes a Page.
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |