|
TaPAS
0.2
|
A by-packet allocator. More...
Go to the source code of this file.
Typedefs | |
| typedef struct ccl_pool_st | ccl_pool |
| Abstract type of a Pool. | |
Functions | |
| ccl_pool * | ccl_pool_create (const char *poolname, size_t object_size, int nb_elements) |
| Creates a pool named by poolname that allocates packets of nb_elements objects each one having a size of object_size bytes. More... | |
| void | ccl_pool_delete (ccl_pool *pool) |
| Deletion of pool. More... | |
| void * | ccl_pool_alloc (ccl_pool *pool) |
| Allocates a new object. More... | |
| void | ccl_pool_release (ccl_pool *pool, void *ptr) |
| Releases the block pointed by ptr. More... | |
| void | ccl_pool_collect (ccl_pool *pool) |
| Tries to collect completely free packets. More... | |
| void | ccl_pool_display_info (ccl_log_type lt, ccl_pool *pool) |
| Display statictics about pool. More... | |
| void | ccl_pools_collect (void) |
| Collect packets in all pools. More... | |
| void | ccl_pools_display_info (ccl_log_type lt) |
| Display statistics about all pools. More... | |
A by-packet allocator.
Definition in file ccl-pool.h.
| void* ccl_pool_alloc | ( | ccl_pool * | pool | ) |
Allocates a new object.
The function looks for a free object in one of the already allocated packets. If such object exists then its address is returned. Else, a new packet is allocated and the address of a fresh object is returned.
The area returned by the function is not filled with zero.
| pool | the pool |
| void ccl_pool_collect | ( | ccl_pool * | pool | ) |
Tries to collect completely free packets.
This function looks for packets whose all objects are free. The memory allocated to such packet is removed.
| pool | the pool |
| ccl_pool* ccl_pool_create | ( | const char * | poolname, |
| size_t | object_size, | ||
| int | nb_elements | ||
| ) |
Creates a pool named by poolname that allocates packets of nb_elements objects each one having a size of object_size bytes.
| poolname | a string displayed with statistics about pools |
| object_size | the size (in bytes) of objects stored in the pool |
| nb_elements | the number of objects allocated by packet |
| void ccl_pool_delete | ( | ccl_pool * | pool | ) |
Deletion of pool.
The function releases all resources allocated to this pool. All packets of objects are also freed thus references to objects are no longer valid after this function.
| pool | the pool to delete |
| void ccl_pool_display_info | ( | ccl_log_type | lt, |
| ccl_pool * | pool | ||
| ) |
Display statictics about pool.
| lt | the stream on which statistics are displayed |
| pool | the pool |
| void ccl_pool_release | ( | ccl_pool * | pool, |
| void * | ptr | ||
| ) |
Releases the block pointed by ptr.
The function puts the block pointed by ptr into the list of free objects of the pool pool.
| pool | the pool |
| ptr | the address of an object to collect |
| void ccl_pools_collect | ( | void | ) |
Collect packets in all pools.
This function simply applies ccl_pool_collect to all existing pools.
| void ccl_pools_display_info | ( | ccl_log_type | lt | ) |
Display statistics about all pools.
This function simply applies ccl_pool_display_info to all existing pools.
| lt | the stream on which statistics are displayed |
1.8.5