n
) times for n
allocations). However, if you know its size in advance, you can precise it in the peak_mem_pool
creation method peak_mem_pool_create(). You can create as many memory pools you want as interface and implementation are object oriented (like most of peak stuffs).
Typedefs | |
typedef __peak_mem_pool * | peak_mem_pool |
Opaque mem_pool pointer type. | |
Functions | |
peak_mem_pool | peak_mem_pool_create (int object_size, int log_size) |
Create a mem_pool object. | |
void * | peak_mem_pool_new (peak_mem_pool pool) |
Allocate an object in constant time. | |
void | peak_mem_pool_delete (peak_mem_pool pool, void *ptr) |
Deallocate an object in constant time. | |
int | peak_mem_pool_get_used_count (peak_mem_pool pool) |
Statistics: get used pointers count. | |
int | peak_mem_pool_get_free_count (peak_mem_pool pool) |
Statistics: get free pointers count. | |
int | peak_mem_pool_get_size (peak_mem_pool pool) |
Statistics: get total pointers count. |
|
Create a mem_pool object.
|
|
Deallocate an object in constant time. This method is guaranted O(1) but in rare case it might free a chunk of memory.
|
|
Statistics: get free pointers count. This method is guaranted O(1).
|
|
Statistics: get total pointers count. This method is guaranted O(1).
|
|
Statistics: get used pointers count. This method is guaranted O(1).
|
|
Allocate an object in constant time. This method is guaranted O(1) almost all the time, but in rare case it might allocate a chunk of memory to let the memory pool grow.
|