group
group__libshare__mempool
The libshare memory buffer pool allocation utilities.

Memory Buffer Pools

typedef
typedef struct shpool_t shpool_t
A memory pool.
function
shpool_t* shpool_init
(void)
Initializes a new memory pool instance.
Return Value
A memory pool of memory buffers. shpool_t structshpool__t compound shbuf_t structshbuf__t compound
function
size_t shpool_size
(shpool_t *pool)
Calculates the number of avaiable memory buffer contained in the memory pool. shbuf_t structshbuf__t compound shpool_t structshpool__t compound
See
shpool_get_index() group__libshare__mempool_1ga5e0a3279f39237d245ac888ab7af2be4 member
function
void shpool_grow
(shpool_t *pool)
Increases the size of the memory pool.
Bug smaller incremental reallocs have been known to fail in glibc bug_1_bug000003
function
shbuf_t* shpool_get
(shpool_t *pool, unsigned int *idx_p)
Get's the next available memory buffer from a pool.
Param
idx_p
A reference that is filled with the retained pool index of the buffer.
function
shbuf_t* shpool_get_index
(shpool_t *pool, int index)
Get's a specific memory buffer by index number. shbuf_t structshbuf__t compound
Param
index
The index number of the memory buffer.
Return Value
The memory buffer associated with the index or NULL if none exist. shbuf_t structshbuf__t compound
function
void shpool_put
(shpool_t *pool, shbuf_t *buff)
Put's a memory buffer into a pool.
function
void shpool_free
(shpool_t **pool_p)
Free's the resources associated with a memory pool.
Param
pool_p
A reference to an allocated pool_t memory pool.