BTstack Memory Pools API

#include "src/btstack_memory_pool.h"

Allocate fixed-size blocks from caller-provided storage.

typedef void * btstack_memory_pool_t;

// initialize memory pool with with given storage, block size and count

btstack_memory_pool_create

void   btstack_memory_pool_create(btstack_memory_pool_t *pool, void * storage, int count, int block_size);

Initialize a fixed-size memory pool using the supplied storage.

Source


// get free block from pool, @return NULL or pointer to block

btstack_memory_pool_get

void * btstack_memory_pool_get(btstack_memory_pool_t *pool);

Allocate a block from the pool, or return NULL if none is available.

Returns

Source


// return previously reserved block to memory pool

btstack_memory_pool_free

void   btstack_memory_pool_free(btstack_memory_pool_t *pool, void * block);

Return a block to the pool.

Source