C Collections

cmempool · Section 3

cmempool_calloc_entry

cmempool_calloc_entry - allocate zero-initialized entry from pool

C Collections (libccollections, -lccollections)

#include <ccollections/cmempool.h>
 
void *cmempool_calloc_entry(cmempool *mp);

The same as cmempool_alloc_entry(), except that the entry is set
to zero before it is returned.

mp   Memory pool to allocate from

Returns a pointer to the zeroed entry on success
Returns NULL when the pool is empty and the fallback is off

O(1) complexity
The whole element is zeroed
Thread-safe if the pool was created with single_threaded=false
The function asserts if mp is NULL

cmempool_alloc_entry(3), cmempool_free_entry(3)