cp_mempool_create(3) - Linux man page

Name

cp_mempool_create, cp_mempool_create_by_option - create a memory pool

Synopsis

#include <cprops/mempool.h>

cp_mempool *cp_mempool_create(const size_t chunksize);
cp_mempool *cp_mempool_create_by_option(const int
mode,

const size_t chunksize, size_t multiple);

Description

cp_mempool_create instiantiates a memory pool serving chunksize byte items. Internally the memory pool allocates several pages at a time, and serves pointers to chunksize memory areas inside these blocks.

cp_mempool_create_by_option allows setting mode bit flags and the number of chunksize items to fit in an internal allocation block.

When creating a pool with cp_mempool_create, allocation and deallocation operations, i.e. cp_mempool_alloc(3) and cp_mempool_free(3), are not synchronized by default. If you choose to share a memory pool between different threads, unset the COLLECTION_MODE_NOSYNC mode bit or create the pool using cp_mempool_create_by_mode.

Return Value

a pointer to a newly allocated cp_mempool object or NULL on failure.

See Also

cp_mempool_inc_refcount(3), cp_mempool_alloc(3), cp_mempool_free(3), cp_mempool_destroy(3), cp_shared_mempool(3)

Referenced By

cp_mempool(3)