C Collections

cmempool · Section 3

crmempool_calloc_entry

crmempool_calloc_entry - allocate zero-initialized entry

C Collections (libccollections, -lccollections)

#include <ccollections/cmempool.h>
 
void *crmempool_calloc_entry(crmempool *rmp, size_t size);

The same as crmempool_alloc_entry(), except that the requested
number of bytes is set to zero before the entry is returned.

rmp   Ranged memory pool to allocate from
size  Size in bytes to allocate

Returns a pointer to the zeroed entry on success
Returns NULL on failure

Exactly 'size' bytes are zeroed, not the full pool element
Thread-safe if the pool was created with single_threaded=false
The function asserts if rmp is NULL

crmempool_alloc_entry(3), crmempool_realloc_entry(3)