cmempool · Section 3
crmempool_total_capacity
NAME
crmempool_total_capacity - get total capacity for a size
LIBRARY
C Collections (libccollections, -lccollections)
SYNOPSIS
#include <ccollections/cmempool.h> size_t crmempool_total_capacity(crmempool *rmp, size_t size);
DESCRIPTION
Returns the total number of entries in the pool that serves the given size, without any dynamic allocation.
PARAMETERS
rmp Ranged memory pool to query size Size in bytes to query (maps to a specific sub-pool)
RETURN VALUE
Returns the total capacity for this size Returns 0 when size is invalid
NOTES
It returns 0 if size is invalid, which means 0 or above largest_size It asserts if rmp is NULL It rounds size up to the next power-of-two pool Thread-safe if the pool was created with single_threaded=false The count reported for a size is the count that its tier was built for, and you can always get that many entries of that size. A tier that is large enough to keep a cache for each thread allocates a reserve above that count, so concurrent callers can hold a few more than this for a short while. cmempool_total_capacity(3) gives the full account.