Games Task Scheduler (GTS)
A multi-processor scheduling framework for games engines
OsMemoryWrapper

Macros

#define GTS_GET_OS_ALLOCATION_GRULARITY()   #error "Replace with custom definition"
 
#define GTS_GET_OS_PAGE_SIZE()   #error "Replace with custom definition"
 
#define GTS_GET_OS_LARGE_PAGE_SIZE()   #error "Replace with custom definition"
 
#define GTS_ENABLE_LARGE_PAGE_SUPPORT()   #error "Replace with custom definition"
 
#define GTS_OS_HEAP_ALLOCATE(size)   #error "Replace with custom definition"
 Allocates a block of memory from the OS Heap. (i.e. HeapAlloc on Win32) More...
 
#define GTS_OS_HEAP_FREE(ptr)   #error "Replace with custom definition"
 
#define GTS_OS_VIRTUAL_ALLOCATE(ptr, size, commit, largePage)   #error "Replace with custom definition"
 Creates a new mapping in the virtual address space of the calling process. More...
 
#define GTS_OS_VIRTUAL_COMMIT(ptr, size)   #error "Replace with custom definition"
 Creates a mapping from a range of virtual address space to physical address space. More...
 
#define GTS_OS_VIRTUAL_DECOMMIT(ptr, size)   #error "Replace with custom definition"
 Unmaps a range of physical address space. More...
 
#define GTS_OS_VIRTUAL_FREE(ptr, size)
 

Detailed Description

User defined wrappers for the OS memory API.

Macro Definition Documentation

◆ GTS_ENABLE_LARGE_PAGE_SUPPORT

#define GTS_ENABLE_LARGE_PAGE_SUPPORT ( )    #error "Replace with custom definition"
Remarks
Signature:
bool enableLargePageSupport()
Returns
True if large pages are enabled.

◆ GTS_GET_OS_ALLOCATION_GRULARITY

#define GTS_GET_OS_ALLOCATION_GRULARITY ( )    #error "Replace with custom definition"
Remarks
Signature:
size_t getAllocationGranularity()
Returns
The allocation granularity for GTS_OS_VIRTUAL_ALLOCATE.

◆ GTS_GET_OS_LARGE_PAGE_SIZE

#define GTS_GET_OS_LARGE_PAGE_SIZE ( )    #error "Replace with custom definition"
Remarks
Signature:
size_t getLargePageSize()
Returns
The allocation granularity for Large Pages. Zero if large pages are not supported.

◆ GTS_GET_OS_PAGE_SIZE

#define GTS_GET_OS_PAGE_SIZE ( )    #error "Replace with custom definition"
Remarks
Signature:
size_t getPageSize()
Returns
The commit granularity for GTS_OS_VIRTUAL_COMMIT.

◆ GTS_OS_HEAP_ALLOCATE

#define GTS_OS_HEAP_ALLOCATE (   size)    #error "Replace with custom definition"

Allocates a block of memory from the OS Heap. (i.e. HeapAlloc on Win32)

Deallocate a block of memory to the OS Heap. (i.e. HeapFree on Win32)

Remarks
Signature:
void* osHeapAlloc(size_t size)
Parameters
sizeThe size of the memory to allocate.
Returns
A pointer to the memory or nullptr on fail.
Remarks
Signature:
bool osHeapFree(void* ptr)
Parameters
ptrA pointer to the memory to free that was allocated with GTS_OS_HEAP_ALLOCATE.

◆ GTS_OS_VIRTUAL_ALLOCATE

#define GTS_OS_VIRTUAL_ALLOCATE (   ptr,
  size,
  commit,
  largePage 
)    #error "Replace with custom definition"

Creates a new mapping in the virtual address space of the calling process.

Remarks
Signature:
void* osVirtualAlloc(void* ptr, size_t size, bool commit, bool largePage)
@ptr Address hint for the mapping.
Parameters
sizeThe size of the memory to reserve or commit. Must be a multiple of GTS_GET_OS_ALLOCATION_GRULARITY.
commitTrue to reserve and commit the memory.
largePageTrue to use Large Pages. Large pages always commit.
Returns
A valid pointer, UINTPTR_MAX if out of memory, or nullptr for other errors.

◆ GTS_OS_VIRTUAL_COMMIT

#define GTS_OS_VIRTUAL_COMMIT (   ptr,
  size 
)    #error "Replace with custom definition"

Creates a mapping from a range of virtual address space to physical address space.

Remarks
Signature:
void* osVirtualCommit(void* ptr, size_t size)
@ptr The starting address of the commit.
Parameters
sizeThe size of the address range. Must be a multiple of GTS_GET_OS_PAGE_SIZE.
Returns
A to the committed memory or nullptr on fail.

◆ GTS_OS_VIRTUAL_DECOMMIT

#define GTS_OS_VIRTUAL_DECOMMIT (   ptr,
  size 
)    #error "Replace with custom definition"

Unmaps a range of physical address space.

Unmaps a range of virtual address space, decommitting any committed page.

Remarks
Signature:
bool osVirtualDecommit(void* ptr, size_t size)
@ptr The starting address of the commit.
Parameters
sizeThe size of the address range. Must be a multiple of GTS_GET_OS_PAGE_SIZE.
Returns
True on success, false on fail.
Remarks
Signature:
bool osVirtualFree(void* ptr)
@ptr The starting address of range to free.
Parameters
sizeThe size of the address range. Must be a multiple of GTS_GET_OS_PAGE_SIZE.
Returns
True on success, false on fail.