MM_FREE — free allocation
#include <simics/device-api.h> // in C
// not available in DML
MM_FREE(p);
MM_FREE frees an allocation previously made with MM_MALLOC, MM_MALLOC_SZ, MM_ZALLOC, MM_ZALLOC_SZ, MM_REALLOC, MM_REALLOC_SZ or MM_STRDUP.
A null pointer argument is legal, in which case nothing happens.
All contexts (including Threaded Context)
MM_MALLOC, MM_MALLOC_SZ, MM_ZALLOC, MM_ZALLOC_SZ — allocate memory
#include <simics/device-api.h> // in C
// not available in DML
MM_MALLOC(nelems, type);
MM_MALLOC_SZ(size, type);
MM_ZALLOC(nelems, type);
MM_ZALLOC_SZ(size, type);
MM_MALLOC allocates nelems objects of type type. MM_MALLOC_SZ specifies the total allocation size in bytes.
MM_ZALLOC and MM_ZALLOC_SZ do the same thing as MM_MALLOC and MM_MALLOC_SZ respectively but in addition fill the allocated memory with null bytes.
If nelems or size are zero, either a null pointer or a pointer to a zero-sized allocation is returned.
Pointer to the allocated object(s).
All contexts (including Threaded Context)
MM_REALLOC, MM_REALLOC_SZ — reallocate memory
#include <simics/device-api.h> // in C
// not available in DML
MM_REALLOC(p, nelems, type);
MM_REALLOC_SZ(p, size, type);
MM_REALLOC changes the size of an allocated memory block to nelems elements. MM_REALLOC_SZ specifies the new size in bytes.
The allocation must originally have been made by a call to MM_MALLOC, MM_MALLOC_SZ, MM_ZALLOC, MM_ZALLOC_SZ, MM_REALLOC, MM_REALLOC_SZ or MM_STRDUP.
If the passed pointer is null, then these macros are equivalent to an allocation of the desired amount. If nelems or size is zero, either a null pointer or a pointer to a zero-sized allocation is returned, and the original allocation is freed.
The allocation must be freed using MM_FREE.
Pointer to the reallocated object(s).
All contexts (including Threaded Context)
MM_STRDUP — duplicate a string
#include <simics/device-api.h> // in C
// not available in DML
MM_STRDUP(str);
Allocates and initializes a copy of the null-terminated string str. The allocation must be freed with MM_FREE.
Pointer to the newly allocated string.
All contexts (including Threaded Context)