A structure containing callback functions for memory allocation. More...
#include "swmemapi.h"
Data Fields | |
sw_api_info | info |
Version number, name, display name, and instance size. More... | |
void *(* | alloc )(sw_memory_instance *instance, size_t size) |
Allocate a block of memory size bytes long. More... | |
void(* | free )(sw_memory_instance *instance, void *memory) |
Free a previously allocated block. More... | |
A structure containing callback functions for memory allocation.
The RIP will provide the module with these callbacks (in the form of memory API instances), which should be used in preference to those provided by the platform. Failure to do this may result in difficulties in configuring the rip for optimal performance. Memory API instances are subclassed by the RIP to encapsulate parameters for particular memory allocators.
void*( * sw_memory_api::alloc) (sw_memory_instance *instance, size_t size) |
Allocate a block of memory size bytes long.
[in] | instance | A sw_memory_instance pointer provided to by the RIP. |
[in] | size | The size, in bytes, of the memory allocation request. |
NULL
if the allocation failed. void( * sw_memory_api::free) (sw_memory_instance *instance, void *memory) |
Free a previously allocated block.
[in] | instance | A sw_memory_instance pointer provided by the RIP. |
[in] | memory | A pointer previously allocated by the alloc() method, which has not yet been freed. It is acceptable to pass NULL as the memory parameter, it will be ignored. |
sw_api_info sw_memory_api::info |
Version number, name, display name, and instance size.
This is REQUIRED to be the first field.