C Collections

cmempool · Section 3

crmempool_dynamic_allocs_count

crmempool_dynamic_allocs_count - get number of dynamic allocations

C Collections (libccollections, -lccollections)

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

Returns the number of heap entries for the given size. Which entries
that covers depends on the fallback policy.

rmp   Ranged memory pool to query
size  Size in bytes to query

Returns the number of dynamic entries
Returns 0 when size is invalid, and 0 when the fallback is off

Returns 0 for crmempool_fallback_disabled
With crmempool_fallback_at_first_exhaustion the dynamic entries are tracked
for each pool separately
With crmempool_fallback_at_last_exhaustion every dynamic entry is tracked
together
Returns 0 if the size is invalid, which means 0 or above largest_size
Asserts if rmp is NULL
Thread-safe if the pool was created with single_threaded=false

crmempool_used_count(3), crmempool_total_capacity(3)