Memory-related utility functions. More...
Data Structures | |
struct | SysMemFns |
Defines a structure to hold a set of system memory allocation functions. More... | |
Macros | |
#define | MemAllocAlign(_x) (((_x) + 7) & (~7)) |
Define byte alignment of allocation via MemAlloc. | |
Typedefs | |
typedef void *() | SysAllocFn(size_t cbSize) |
Type of a callback function for allocating system memory. More... | |
typedef void() | SysFreeFn(void *pbMem) |
Type of a callback function for de-allocating system memory. More... | |
typedef struct SysMemFns | SysMemFns |
Defines a structure to hold a set of system memory allocation functions. | |
Enumerations | |
enum | MEM_ALLOC_values { MEM_ALLOC_RETURN_NULL = 0 , MEM_ALLOC_EXIT_PROCESS = 1 , MEM_ALLOC_RIP_LOWMEM = 2 } |
Functions | |
void | MemLogInit (const char *mps_log, unsigned long mps_telemetry) |
Set up the memory system to log to a file. More... | |
HqBool | MemInit (size_t *RIP_maxAddressSpaceInBytes, size_t *RIP_workingSizeInBytes, void *pMemory, SysMemFns *pSysMemFns) |
Initialise the memory arena and create the memory pool for use in skin. More... | |
void | MemFinish (int32 fError) |
Release the arena of managed memory. More... | |
void * | MemAlloc (size_t cbSize, HqBool fZero, int actionOnFail) |
Allocate a block of memory for use by the skin layer. More... | |
void * | MemRealloc (void *ptr, size_t cbSize) |
Reallocate a block of memory that was allocated by a prior call to MemAlloc(). More... | |
void | MemFree (void *pbMem) |
Free a block of memory that was allocated by a prior call to MemAlloc(). More... | |
void * | SysAlloc (size_t cbSize) |
Allocate a block of system memory for use by the skin layer. More... | |
void | SysFree (void *pbMem) |
Free a block of memory that was allocated by a prior call to SysAlloc(). More... | |
mps_arena_t | MemGetArena (void) |
Returns the single arena of managed memory that is shared between the core RIP and the skin layer. | |
void | GetMemorySizesInBytes (size_t *addressSpace, size_t *physicalMemory) |
Obtain the best possible measure, in bytes, of the virtual address space and the amount of physical RAM installed on the host machine. More... | |
uint32 | GetPeakMemoryUsageInMegabytes (void) |
Obtain the best possible measure, in megabytes, of the maximum amount of memory that this process has ever used. More... | |
size_t | GetPeakArenaSize (void) |
Obtain the peak arena size in bytes. More... | |
size_t | GetArenaCommitLimit (void) |
Obtain the commit limit of the arena in bytes. More... | |
int32 | GetCurrentProcessHandleCount (void) |
Obtain current number of open handles this process has. More... | |
Memory-related utility functions.
This file defines the skin interface for memory management. This includes familiar allocation and de-allocation routines for claiming portions of private memory within the skin. It also includes functions for creating and constraining the RIP's main memory arena, which is shared by the core RIP and the skin. The hosting application must create this arena with MemInit() before booting the RIP, and destroy it with MemFinish() after shutting the RIP down.
Copyright (C) 2023 Global Graphics Software Ltd. All rights reserved.
This example is provided on an "as is" basis and without warranty of any kind. Global Graphics Software Ltd. does not warrant or make any representations regarding the use or results of use of this example.