#include <mlMemory.h>
Static Public Member Functions | |
| static void * | allocateMemory (MLuint numBytes, MLMemoryErrorHandling handleFailure) |
Allocates a memory block of numByts. | |
| static void * | reallocateMemory (void *ptr, MLuint numBytes, MLMemoryErrorHandling handleFailure) |
The memory block pointed to by ptr is resized and copied so that it has at least numBytes. | |
| static void | freeMemory (void *ptr) |
| Free function to be use instead of free if code is written which uses/bases on the ML. | |
| static void * | duplicateMemory (const void *ptr, MLuint numBytes, MLMemoryErrorHandling handleFailure) |
Copies the memory pointed to by ptr of size numBytes in a newly allocated buffer which must be freed by the caller with freeMemory(). | |
| static char * | duplicateString (const char *str, MLMemoryErrorHandling handleFailure) |
Copies the passed null terminated string str in a newly allocated buffer which must be freed by the caller with freeMemory(). | |
See mlDataTypes.h for enum MLMemoryErrorHandling.
Definition at line 28 of file mlMemory.h.
| static void* ml::Memory::allocateMemory | ( | MLuint | numBytes, | |
| MLMemoryErrorHandling | handleFailure | |||
| ) | [static] |
Allocates a memory block of numByts.
Should be used instead of normal malloc if code is written which uses/bases on the ML. For handleFailure see MLMemoryErrorHandling.
| static void* ml::Memory::duplicateMemory | ( | const void * | ptr, | |
| MLuint | numBytes, | |||
| MLMemoryErrorHandling | handleFailure | |||
| ) | [static] |
Copies the memory pointed to by ptr of size numBytes in a newly allocated buffer which must be freed by the caller with freeMemory().
For handleFailure see MLMemoryErrorHandling. If ptr is passed as NULL, NULL is returned without any error handling.
| static char* ml::Memory::duplicateString | ( | const char * | str, | |
| MLMemoryErrorHandling | handleFailure | |||
| ) | [static] |
Copies the passed null terminated string str in a newly allocated buffer which must be freed by the caller with freeMemory().
For handleFailure see MLMemoryErrorHandling.
| static void ml::Memory::freeMemory | ( | void * | ptr | ) | [static] |
Free function to be use instead of free if code is written which uses/bases on the ML.
NULL pointers may be passed savely; they are simply ignored.
| static void* ml::Memory::reallocateMemory | ( | void * | ptr, | |
| MLuint | numBytes, | |||
| MLMemoryErrorHandling | handleFailure | |||
| ) | [static] |
The memory block pointed to by ptr is resized and copied so that it has at least numBytes.
Should be used instead of normal realloc if code is written which uses/bases on the ML. For handleFailure see MLMemoryErrorHandling.
1.5.8