Custom memory manager. More...
#include "kzc_memory_common.h"
#include <system/kzs_types.h>
#include <system/debug/kzs_error.h>
#include <system/kzs_header.h>
Typedefs | |
typedef kzsError(* | KzcMemoryAllocFunction )(void *customData, kzSizeT size, void **out_pointer) |
Memory allocation function type. More... | |
typedef kzsError(* | KzcMemoryFreeFunction )(void *customData, void *pointer) |
Memory deallocation function type. More... | |
Functions | |
kzsError | kzcMemoryManagerCreateCustomManager (KzcMemoryAllocFunction allocator, KzcMemoryFreeFunction deallocator, void *customData, struct KzcMemoryManager **out_memoryManager) |
Creates a new memory manager, which allocates the memory with custom memory allocation functions. More... | |
Custom memory manager.
Custom memory manager provides a way to plug in arbitrary memory allocation mechanisms. A custom Kanzi memory manager can be created with kzcMemoryManagerCreateCustomManager() by passing your own allocation and deallocation functions.
Copyright 2008-2020 by Rightware. All rights reserved.
Memory allocation function type.
Used for custom memory managers.
customData | The customData pointer passed to kzcMemoryManagerCreateCustomManager(). |
size | Requested number of bytes to allocate. |
out_pointer | A pointer that should be set to point to the beginning of the allocated memory area. |
typedef kzsError(* KzcMemoryFreeFunction)(void *customData, void *pointer) |
Memory deallocation function type.
Used for custom memory managers.
customData | The customData pointer passed to kzcMemoryManagerCreateCustomManager(). |
pointer | Pointer to the beginning of the memory area to free. |
kzsError kzcMemoryManagerCreateCustomManager | ( | KzcMemoryAllocFunction | allocator, |
KzcMemoryFreeFunction | deallocator, | ||
void * | customData, | ||
struct KzcMemoryManager ** | out_memoryManager | ||
) |
Creates a new memory manager, which allocates the memory with custom memory allocation functions.
allocator | Memory allocation function to call when memory is allocated with this memory manager. |
deallocator | Memory deallocation function to call when memory is freed with this memory manager. |
customData | Arbitrary pointer passed to the allocator and deallocator functions. |
out_memoryManager | A pointer that is set to point to the new memory manager on success. |