|
Veritable Lasagna
An Allocator & Data Structure Library for C.
|
Include dependency graph for vl_pool.c:Functions | |
| vl_pool_node * | vl_PoolNodeNew (vl_pool *pool) |
| void | vlPoolInitAligned (vl_pool *pool, vl_uint16_t elementSize, vl_uint16_t alignment) |
| Initializes the specified fixed pool instance with specified element size and alignment. | |
| vl_pool_idx | vlPoolTake (vl_pool *pool) |
| Takes a new index from the fixed pool, which corresponds to a valid memory location within the pool. | |
| void | vlPoolReturn (vl_pool *pool, vl_pool_idx idx) |
| Gives the specified index back to the fixed pool, allowing it to be re-used. | |
| void * | vlPoolSample (vl_pool *pool, vl_pool_idx idx) |
| Samples the specified fixed pool and retrieves a pointer to the memory associated with the specified pool index. | |
| void | vlPoolClear (vl_pool *pool) |
| Clears the specified pool. | |
| void | vlPoolFree (vl_pool *pool) |
| De-initializes the specified pool instance. | |
| void | vlPoolReset (vl_pool *pool) |
| Resets the specified pool to its initial state. | |
| void | vlPoolReserve (vl_pool *pool, vl_dsidx_t n) |
| Ensures that at least n additional elements can be taken without triggering further allocations. | |
| vl_pool * | vlPoolClone (const vl_pool *src, vl_pool *dest) |
| Clones the specified source fixed pool. | |
| vl_pool * | vlPoolNewAligned (vl_uint16_t elementSize, vl_uint16_t alignment) |
| Allocates and initializes a new fixed pool instance with specific alignment. | |
| void | vlPoolDelete (vl_pool *pool) |
| De-initializes and deletes the specified fixed pool instance. | |
| vl_pool_node * vl_PoolNodeNew | ( | vl_pool * | pool | ) |
Here is the call graph for this function:
Here is the caller graph for this function:| void vlPoolClear | ( | vl_pool * | pool | ) |
Clears the specified pool.
Resets each underlying memory block's counter to 0 and resets the free index stack. This effectively marks all pooled slots as available for reuse.
vlPoolSample become invalid.pool must not be NULL.| pool | pool pointer |
Here is the caller graph for this function:Clones the specified source fixed pool.
Clones the entirety of the src pool to the dest pool, including all management state and element data.
The 'src' pool pointer must be non-null and initialized. The 'dest' pool pointer may be null, but if it is not null it must be initialized.
If the 'dest' pool pointer is null, a new pool is initialized via vlPoolNew. Otherwise, its element size is set to the source's and the destination is reset via vlPoolReset.
dest is NULL, the caller owns the returned vl_pool. If dest is provided, ownership remains with the caller.dest pool remains valid until deleted or freed.src must not be NULL. dest can be NULL.NULL on allocation failure.vl_pool struct (if dest is NULL) and multiple memory block nodes.dest or a new instance), or NULL on failure.| src | pointer to pool to clone |
| dest | pointer to target pool, or NULL |
Here is the call graph for this function:
Here is the caller graph for this function:| void vlPoolDelete | ( | vl_pool * | pool | ) |
De-initializes and deletes the specified fixed pool instance.
This frees all internally allocated memory blocks, management structures, and the vl_pool struct itself. This pool should have been initialized via vlPoolNew(Ext).
vl_pool struct.pool should not be NULL.vlMemFree and free.| pool | pointer |
Here is the call graph for this function:| void vlPoolFree | ( | vl_pool * | pool | ) |
De-initializes the specified pool instance.
This will clear up all memory associated with members of the pool, including all allocated block nodes and management tables. This pool should have been initialized via vlPoolInit(Ext).
pool struct itself.vlPoolTake and all pointers from vlPoolSample become invalid.pool must not be NULL.vlMemFree.| pool | pointer |
Here is the call graph for this function:
Here is the caller graph for this function:| void vlPoolInitAligned | ( | vl_pool * | pool, |
| vl_uint16_t | elementSize, | ||
| vl_uint16_t | alignment | ||
| ) |
Initializes the specified fixed pool instance with specified element size and alignment.
This pool should be de-initialized via vlPoolFree.
pool struct. The function initializes internal management structures.pool struct must remain valid for the duration of its use. Internal allocations are valid until vlPoolFree or vlPoolDelete.pool is NULL, the function returns immediately (no-op).alignment is not a power of 2. Passing an already initialized pool without first calling vlPoolFree (causes memory leak).vlMemAlloc and vlMemAllocAligned.| pool | pointer |
| elementSize | size of each element, in bytes. |
| alignment | alignment of each element, in bytes. |
Here is the call graph for this function:
Here is the caller graph for this function:| vl_pool * vlPoolNewAligned | ( | vl_uint16_t | elementSize, |
| vl_uint16_t | alignment | ||
| ) |
Allocates and initializes a new fixed pool instance with specific alignment.
This pool should later be deleted via vlPoolDelete.
vl_pool pointer and is responsible for calling vlPoolDelete.vlPoolDelete.NULL if heap allocation for the vl_pool struct fails.NULL on allocation failure.alignment is not a power of 2.vl_pool struct and its management structures.NULL.| elementSize | size of each element, in bytes. |
| alignment | alignment of each element, in bytes. |
Here is the call graph for this function:
Here is the caller graph for this function:| void vlPoolReserve | ( | vl_pool * | pool, |
| vl_dsidx_t | n | ||
| ) |
Ensures that at least n additional elements can be taken without triggering further allocations.
This may create one or more new block nodes, following the geometric growth strategy (doubling size).
pool must not be NULL.| pool | pointer |
| n | total additional elements to reserve space for |
Here is the call graph for this function:
Here is the caller graph for this function:| void vlPoolReset | ( | vl_pool * | pool | ) |
Resets the specified pool to its initial state.
Deletes all memory block nodes except for the initial one, and resets all counters and the free stack.
pool must not be NULL.vlMemFree.| pool |
Here is the call graph for this function:
Here is the caller graph for this function:| void vlPoolReturn | ( | vl_pool * | pool, |
| vl_pool_idx | idx | ||
| ) |
Gives the specified index back to the fixed pool, allowing it to be re-used.
idx can be VL_POOL_INVALID_IDX (no-op).| pool | pointer |
| idx | element index |
Here is the call graph for this function:
Here is the caller graph for this function:| void * vlPoolSample | ( | vl_pool * | pool, |
| vl_pool_idx | idx | ||
| ) |
Samples the specified fixed pool and retrieves a pointer to the memory associated with the specified pool index.
NULL if idx is VL_POOL_INVALID_IDX or if the block associated with the index is not found.NULL.| pool | pointer to the fixed pool |
| idx | numeric index of pooled memory instance |
Here is the caller graph for this function:| vl_pool_idx vlPoolTake | ( | vl_pool * | pool | ) |
Takes a new index from the fixed pool, which corresponds to a valid memory location within the pool.
If no free slots are available in existing blocks, a new memory block node is automatically allocated.
vlPoolReturn or the pool is destroyed/reset.VL_POOL_INVALID_IDX if allocation fails when growing the pool.VL_POOL_INVALID_IDX on allocation failure.vlMemAllocAligned and vlMemRealloc.vl_pool_idx) to an element, or VL_POOL_INVALID_IDX on failure.| pool | pointer |
Here is the call graph for this function:
Here is the caller graph for this function: