Veritable Lasagna
An Allocator & Data Structure Library for C.
|
Functions | |
vl_fixed_pool_node * | vl_PoolNodeNew (vl_fixedpool *pool) |
void | vlFixedPoolInit (vl_fixedpool *pool, vl_ularge_t elementSize) |
Initializes the specified fixed pool instance. | |
vl_fixedpool_idx | vlFixedPoolTake (vl_fixedpool *pool) |
void | vlFixedPoolReturn (vl_fixedpool *pool, vl_fixedpool_idx idx) |
void | vlFixedPoolClear (vl_fixedpool *pool) |
void | vlFixedPoolFree (vl_fixedpool *pool) |
De-initializes the specified pool instance. | |
void | vlFixedPoolReset (vl_fixedpool *pool) |
void | vlFixedPoolReserve (vl_fixedpool *pool, vl_dsidx_t numElements) |
Ensures space for n-many elements in the pool. | |
vl_fixedpool * | vlFixedPoolClone (const vl_fixedpool *src, vl_fixedpool *dest) |
Clones the specified source fixed pool. | |
vl_fixedpool * | vlFixedPoolNew (vl_ularge_t elementSize) |
Allocates and initializes a fixed pool instance. | |
void | vlFixedPoolDelete (vl_fixedpool *pool) |
De-initializes and deletes the specified fixed pool. This will clear up all memory associated with members of the pool. This pool should have been initialized via vlFixedPoolNew. | |
vl_fixed_pool_node * vl_PoolNodeNew | ( | vl_fixedpool * | pool | ) |
void vlFixedPoolClear | ( | vl_fixedpool * | pool | ) |
Clears the specified pool. This does not clear any buffers associated with the pool. Rather, this resets each underlying memory block's counter to 0, and resets the free stack.
pool | fixed pool pointer |
vl_fixedpool * vlFixedPoolClone | ( | const vl_fixedpool * | src, |
vl_fixedpool * | dest ) |
Clones the specified source fixed pool.
Clones the entirety of the src pool to the dest pool.
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 vlFixedPoolNew. Otherwise, its element size is set to the source's and the destination is reset via vlFixedPoolReset.
src | pointer to pool to clone |
dest | pointer to target pool, or NULL |
void vlFixedPoolDelete | ( | vl_fixedpool * | pool | ) |
De-initializes and deletes the specified fixed pool. This will clear up all memory associated with members of the pool. This pool should have been initialized via vlFixedPoolNew.
pool | pointer |
void vlFixedPoolFree | ( | vl_fixedpool * | pool | ) |
De-initializes the specified pool instance.
This will clear up all memory associated with members of the pool.
This pool should have been initialized via vlFixedPoolInit.
pool | pointer |
void vlFixedPoolInit | ( | vl_fixedpool * | pool, |
vl_ularge_t | elementSize ) |
Initializes the specified fixed pool instance.
This pool should be freed via vlFixedPoolFree.
pool | pointer |
elementSize | size of each element, in bytes. |
vl_fixedpool * vlFixedPoolNew | ( | vl_ularge_t | elementSize | ) |
Allocates and initializes a fixed pool instance.
This pool should later be deleted via vlFixedPoolDelete.
elementSize | size of each element, in bytes. |
void vlFixedPoolReserve | ( | vl_fixedpool * | pool, |
vl_dsidx_t | n ) |
Ensures space for n-many elements in the pool.
This is accomplished by using the standard buffer resizing method for this library, which is doubling the size of the underlying storage until it is greater than a specified minimum size. A new node may be created twice the size of all created before it.
This function will only sometimes result in allocation of a new node.
pool | pointer |
n | total elements to reserve space for |
void vlFixedPoolReset | ( | vl_fixedpool * | pool | ) |
Resets the specified pool. This deletes all but the initial memory block. This leaves the pool in a "new" state, freeing memory in the process.
pool |
void vlFixedPoolReturn | ( | vl_fixedpool * | pool, |
vl_fixedpool_idx | idx ) |
Gives the specified index back to the fixed pool, allowing it to be re-used.
pool | pointer |
idx | element index |
vl_fixedpool_idx vlFixedPoolTake | ( | vl_fixedpool * | pool | ) |
Takes a new index from the fixed pool, which corresponds to a valid memory location within the pool.
pool | pointer |