Static Public Member Functions | |
| static D_CORE_API void * | Malloc (size_t size) |
| General Memory allocation function. More... | |
| static D_CORE_API void | Free (void *const ptr) |
| Destroy a memory buffer previously allocated by Malloc. | |
| static D_CORE_API ndInt32 | GetSize (void *const ptr) |
| Get memory buffer size previously allocated by Malloc. | |
| static D_CORE_API ndInt32 | CalculateBufferSize (size_t size) |
| Calculate buffer size. | |
| static D_CORE_API ndUnsigned64 | GetMemoryUsed () |
| Return the total memory allocated by the newton engine and tools. | |
| static D_CORE_API void | SetMemoryAllocators (ndMemAllocCallback alloc, ndMemFreeCallback free) |
| Install low level system memory allocation functions. More... | |
| static D_CORE_API void | GetMemoryAllocators (ndMemAllocCallback &alloc, ndMemFreeCallback &free) |
|
static |
General Memory allocation function.
All memory allocations used by the Newton Engine and Tools are performed by calling this function.
|
static |
Install low level system memory allocation functions.
| ndMemAllocCallback | alloc: is a function pointer callback to allocate a memory chunk. |
| ndMemFreeCallback | free: is a function pointer callback to free a memory chunk. |
All memory allocated by alloc, does not need to be aligned, therefore an application can write them using standard malloc and free. By default the memory allocation is set to call the standard library functions malloc and free, however if an application wants to keep track of how memory is used, it must install the memory callbacks by calling this function before any class of the Newton Engine or tool was created or instantiated. The engine does not do any global allocation using global operators new and delete, therefore it is ok to install the memory allocator on the main of the application or just before start using the engine.