cmempool · Section 3
crmempool_destroy
NAME
crmempool_destroy - destroy a ranged memory pool
LIBRARY
C Collections (libccollections, -lccollections)
SYNOPSIS
#include <ccollections/cmempool.h> crmempool_destroy(rmp);
DESCRIPTION
Frees every resource of the ranged memory pool, all its sub-pools included. For a pool created from a preallocated buffer the macro doesn't free the buffer itself.
PARAMETERS
rmp Ranged memory pool to destroy. The macro sets it to NULL
NOTES
Calling the macro with a NULL pointer is safe For a preallocated pool, the buffer's lifetime is the caller's business The macro evaluates rmp exactly once. It must be a modifiable lvalue, such as a variable or an element of an array, so with an expression that has a side effect, such as handles[i++], it destroys and clears one element.
WARNINGS
A pointer from the dynamic fallback that was never freed makes the destroy fail an assertion, so free every allocated entry before you destroy the pool.