46#ifndef DW_CORE_DYNAMIC_MEMORY_H_
47#define DW_CORE_DYNAMIC_MEMORY_H_
53#define DWALLOC_API_PUBLIC __attribute__((visibility("default")))
55#define DWALLOC_API_PUBLIC
72typedef void* (*dwDynamicMemoryMallocCallback)(
size_t sizeInByte,
void* userData);
90 void*
const userData);
112 void**
const userData);
#define DWALLOC_API_PUBLIC
DWALLOC_API_PUBLIC bool dwDynamicMemory_getRuntimeMode(dwRuntimeMode *const mode)
Return currently selected runtime mode.
DWALLOC_API_PUBLIC void dwDynamicMemory_release()
Release dwDynamicMemory.
DWALLOC_API_PUBLIC bool dwDynamicMemory_setRuntimeMode(dwRuntimeMode const newMode)
Switch runtime mode for all Driveworks SDK.
DWALLOC_API_PUBLIC void dwDynamicMemory_initialize(dwDynamicMemoryMallocCallback mallocCallback, dwDynamicMemoryFreeCallback freeCallback, void *const userData)
Initialize dwDynamicMemory with user-defined callback for user space memory allocations.
void(* dwDynamicMemoryErrorCallback)(dwDynamicMemoryError error, size_t lastRequestedSizeInByte, void *userData)
void(* dwDynamicMemoryFreeCallback)(void *addr, void *userData)
void *(* dwDynamicMemoryMallocCallback)(size_t sizeInByte, void *userData)
DWALLOC_API_PUBLIC void dwDynamicMemory_getCallbacks(dwDynamicMemoryMallocCallback *const mallocCallback, dwDynamicMemoryFreeCallback *const freeCallback, void **const userData)
Get callbacks and user-defined general pointer previously passed in dwDynamicMemory_initialize.
DWALLOC_API_PUBLIC void dwDynamicMemory_free(void *const ptr)
Release memory chunk previously allocated with dwDynamicMemory_malloc().
dwRuntimeMode
Context runtime mode.
dwDynamicMemoryError
Error to be reported through error callback.
DWALLOC_API_PUBLIC void dwDynamicMemory_setErrorCallback(dwDynamicMemoryErrorCallback errorCallback, void *const userData)
Set error callback to be executed on an allocation error.
DWALLOC_API_PUBLIC void * dwDynamicMemory_malloc(size_t const size)
Allocate chunk of memory using allocator passed through dwDynamicMemory_initialize().
@ DW_MODE_CLEANUP
Heap memory allocations and deallocations are allowed.
@ DW_MODE_INIT
Heap memory allocations and deallocations are allowed. Default.
@ DW_MODE_RUNTIME
Heap memory allocations are not allowed.
@ DW_DYNAMIC_MEMORY_ALLOC_NOT_ALLOWED
Allocation is currently not allowed, because in runtime mode.
@ DW_DYNAMIC_MEMORY_SUCCESS
no error
@ DW_DYNAMIC_MEMORY_FREE_NOT_ALLOWED
Memory release is currently not allowed, because in runtime mode.
@ DW_DYNAMIC_MEMORY_BAD_ALLOC
Memory allocation failed, probably not enough memory.