|
Kanzi Graphics Engine
|
Core memory manager. More...
#include "kzc_memory_common.h"#include <system/kzs_types.h>#include <system/debug/kzs_error.h>#include <system/kzs_header.h>Macros | |
| #define | KZC_MEMORY_MANAGER_SIZE_UNSPECIFIED |
| Constant for memory manager size that's unspecified. More... | |
| #define | kzcMemoryAllocPointer(manager_param, pointer_param, size_param, description_param) |
| Allocates arbitrary memory pointer using the given memory manager. More... | |
| #define | kzcMemoryAllocArray(manager_param, array_param, length_param, description_param) |
| Allocates array of arbitrary type using the given memory manager. More... | |
| #define | kzcMemoryAllocVariable(manager_param, variable_param, description_param) |
| Allocates an object of arbitrary type using the given memory manager. More... | |
Functions | |
| kzsError | kzcMemoryManagerDelete (struct KzcMemoryManager *memoryManager) |
| Frees the memory allocated for a memory manager. More... | |
| kzsError | kzcMemoryAllocPointer_private (const struct KzcMemoryManager *memoryManager, kzSizeT size, void **out_pointer MEMORY_MANAGER_DEBUG_PARAM_PRIVATE(kzString description)) |
| kzsError | kzcMemoryAllocArray_private (const struct KzcMemoryManager *memoryManager, kzUint length, kzSizeT elementSize, void **out_array MEMORY_MANAGER_DEBUG_PARAM_PRIVATE(kzString description)) |
| kzsError | kzcMemoryReallocPointer (void *pointer, kzSizeT oldSize, kzSizeT newSize, void **out_newPointer) |
| Reallocates arbitrary memory pointer to the given new size. More... | |
| kzsError | kzcMemoryFreePointer (void *pointer) |
| Frees an arbitrary pointer from memory manager. More... | |
| kzsError | kzcMemoryFreeArray (void *array) |
| Frees an array from memory manager. More... | |
| kzsError | kzcMemoryFreeVariable (void *variable) |
| Frees a variable from memory manager. More... | |
| kzBool | kzcIsValidPointer (const void *pointer) |
| Checks if the given pointer is valid. More... | |
| kzBool | kzcIsValidArrayIndex (const void *array, kzUint index) |
| Checks if the given index is valid for the given array. More... | |
| kzU32 | kzcMemoryCalculateChecksum (const void *pointer) |
| Calculates a checksum of the given pointer. More... | |
| struct KzcMemoryManager * | kzcMemoryGetManager (const void *pointer) |
| Gets the memory manager responsible of the given pointer. More... | |
| kzUint | kzcArrayLength (const void *array) |
| Returns the length of an array. More... | |
| enum KzcMemoryManagerType | kzcMemoryManagerGetType (const struct KzcMemoryManager *memoryManager) |
| Gets memory manager type. More... | |
| kzSizeT | kzcMemoryManagerGetSize (const struct KzcMemoryManager *memoryManager) |
| Gets size of memory manager in bytes. More... | |
| void | kzcMemoryManagerDisownFromThread (struct KzcMemoryManager *memoryManager) |
| Disowns a memory manager from its owning thread. More... | |
Core memory manager.
Memory managers provide memory allocation and deallocation functionality. This header file provides the common interface for all Kanzi memory managers. There are four different types of Kanzi memory managers: system, pooled, quick and custom. The custom type provides a way to implement your own memory manager. See kzc_memory_system.h, kzc_memory_pooled.h, kzc_memory_quick.h and kzc_memory_custom.h for descriptions of each of them.
Copyright 2008-2019 by Rightware. All rights reserved.
| #define KZC_MEMORY_MANAGER_SIZE_UNSPECIFIED |
Constant for memory manager size that's unspecified.
| #define kzcMemoryAllocPointer | ( | manager_param, | |
| pointer_param, | |||
| size_param, | |||
| description_param | |||
| ) |
Allocates arbitrary memory pointer using the given memory manager.
| #define kzcMemoryAllocArray | ( | manager_param, | |
| array_param, | |||
| length_param, | |||
| description_param | |||
| ) |
Allocates array of arbitrary type using the given memory manager.
| #define kzcMemoryAllocVariable | ( | manager_param, | |
| variable_param, | |||
| description_param | |||
| ) |
Allocates an object of arbitrary type using the given memory manager.
| kzsError kzcMemoryManagerDelete | ( | struct KzcMemoryManager * | memoryManager) |
Frees the memory allocated for a memory manager.
| kzsError kzcMemoryAllocPointer_private | ( | const struct KzcMemoryManager * | memoryManager, |
| kzSizeT | size, | ||
| void **out_pointer | MEMORY_MANAGER_DEBUG_PARAM_PRIVATEkzString description | ||
| ) |
| kzsError kzcMemoryAllocArray_private | ( | const struct KzcMemoryManager * | memoryManager, |
| kzUint | length, | ||
| kzSizeT | elementSize, | ||
| void **out_array | MEMORY_MANAGER_DEBUG_PARAM_PRIVATEkzString description | ||
| ) |
| kzsError kzcMemoryReallocPointer | ( | void * | pointer, |
| kzSizeT | oldSize, | ||
| kzSizeT | newSize, | ||
| void ** | out_newPointer | ||
| ) |
Reallocates arbitrary memory pointer to the given new size.
This function behaves differently from C realloc function such that the given pointer may not be KZ_NULL and the function never returns KZ_NULL in case of success. The function returns a pointer containing the data of the given pointer up to the length of min(newSize, old size). The old pointer is freed if new memory was allocated.
Checks if the given index is valid for the given array.
Calculates a checksum of the given pointer.
This value can later be used for checking if the memory content has been modified.
| struct KzcMemoryManager* kzcMemoryGetManager | ( | const void * | pointer) |
Gets the memory manager responsible of the given pointer.
| enum KzcMemoryManagerType kzcMemoryManagerGetType | ( | const struct KzcMemoryManager * | memoryManager) |
Gets memory manager type.
| kzSizeT kzcMemoryManagerGetSize | ( | const struct KzcMemoryManager * | memoryManager) |
Gets size of memory manager in bytes.
Returns KZC_MEMORY_MANAGER_SIZE_NOT_SPECIFIED if not specified.
| void kzcMemoryManagerDisownFromThread | ( | struct KzcMemoryManager * | memoryManager) |
Disowns a memory manager from its owning thread.
Effectively allows transferring a memory manager to another thread.