Function
uni_setmemfunc
Custom memory allocator.
Since v1.0
unistat uni_setmemfunc(
void *user_data,
unimemfunc allocf)
Parameters 🔗
user_data | in | User pointer passed to unimemfunc. |
allocf | in | Memory management routine. |
Return Value 🔗
UNI_OK | If the memory allocator was modified. |
UNI_FEATURE_DISABLED | If |
Discussion 🔗
Sets allocf
as the implementation for dynamic memory allocations. If allocf
is NULL
then the implementation reverts to its default allocator which may be the C standard allocator or a dummy allocator that always fails to allocate memory. The latter is only present when the C standard library allocators are disabled.
Support for C standard library allocators must be enabled in the JSON configuration file.
{
"hasStandardAllocators": true
}