|
NAME | SYNOPSIS | DESCRIPTION | RETURN VALUE | ERRORS | ATTRIBUTES | STANDARDS | NOTES |
darenainit dmalloc API functions manual darenainit
darenainit - initializes an arena.
#include "dmalloc.h"
int darenainit(void* backing_memory, size_t capacity);
The function darenainit() initializes the memory region pointed to by
backing_memory and of size capacity to an arena. If backing_memory is
NULL, the function just returns 0.
On success, darenainit() returns 0. On failure, it returns -1, and sets
errno.
ENOMEM Out of memory. darenainit() failed because capacity was not big
enough for a properly initialized arena.
For an explanation of the terms used in this section, see attributes(7).
┌────────────────────────────────────┬───────────────┬───────────┐
│ Interface │ Attribute │ Value │
├────────────────────────────────────┼───────────────┼───────────┤
│ arenainit() │ Thread safety │ MT-Unsafe │
└────────────────────────────────────┴───────────────┴───────────┘
None.
Trying to initialize an arena more than once is considered unsafe. It
can still be done in single-threaded applications, because the critical
step of arena initialization deals with mutexes, but it does become
source of undefined behaviour in multi-threaded applications.
Initalizing an arena more that once both includes multiple calls to
darenainit() on the same backing memory in the same thread and
sigle calls to such function by different thread at possibly the same
time.
In any case, note that, after initialization, any arena is safe to be
used in a multi-threaded context with all of the other allocator
functions.
dmalloc API functions manual 2026-04-13 darenainit