C Collections

cmempool · Section 3

crmempool_destroy

crmempool_destroy - destroy a ranged memory pool

C Collections (libccollections, -lccollections)

#include <ccollections/cmempool.h>
 
crmempool_destroy(rmp);

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.

rmp  Ranged memory pool to destroy. The macro sets it to NULL

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.

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.

crmempool_create_mp(3), cmempool_destroy(3)