Functions | |
int | ememoa_mempool_fixed_init (struct ememoa_mempool_fixed_s *memory, unsigned int object_size, unsigned int preallocated_item_pot, unsigned int options, const struct ememoa_mempool_desc_s *desc) |
Initializes a memory pool structure for later use. | |
int | ememoa_mempool_fixed_clean (struct ememoa_mempool_fixed_s *memory) |
Destroys all allocated objects of the memory pool and uninitialize them. | |
void * | ememoa_mempool_fixed_pop_object (struct ememoa_mempool_fixed_s *memory) |
Pops a new object out of the memory pool. | |
int | ememoa_mempool_fixed_free_all_objects (struct ememoa_mempool_fixed_s *memory) |
Destroys all allocated object of the memory pool. | |
int | ememoa_mempool_fixed_push_object (struct ememoa_mempool_fixed_s *memory, void *ptr) |
Push back an object in the memory pool. | |
int | ememoa_mempool_fixed_garbage_collect (struct ememoa_mempool_fixed_s *memory) |
Collects all the empty pool and resizes the Mempool accordingly. | |
int | ememoa_mempool_fixed_walk_over (struct ememoa_mempool_fixed_s *memory, ememoa_fctl fctl, void *data) |
Executes fctl on all allocated data in the pool. |
|
Destroys all allocated objects of the memory pool and uninitialize them. The memory pool is unusable after the call of this function. The following example code demonstrates how to ensure that a given memory pool has been successfully destroyed
if (ememoa_mempool_fixed_clean (&test_pool)) { fprintf (stderr, "ERROR: Memory pool destruction failed.\n"); exit (-1); }
|
|
Destroys all allocated object of the memory pool. The memory pool is still usable after the call of this function.
|
|
Collects all the empty pool and resizes the Mempool accordingly. The following example code demonstrates how to ensure that a given Mempool gives back some memory or die.
|
|
Initializes a memory pool structure for later use. The following example code demonstrates how to ensure that the given memory pool has been successfully initialized.
struct ememoa_mempool_fixed_s test_pool; if (ememoa_mempool_fixed_init (&test_pool, sizeof (int), 10, NULL)) { fprintf (stderr, "ERROR: Memory pool initialization failed\n"); exit (-1); }
|
|
Pops a new object out of the memory pool. The following example code demonstrate how to ensure that a pointer has been successfully retrieved from the memory pool.
object_s *new_object = ememoa_mempool_fixed_pop_object (&mempool_of_object); if (new_object == NULL) { fprintf (stderr, "ERROR: %s", ememoa_mempool_error2string (mempool_of_object.last_error_code)); exit (-1); }
|
|
Push back an object in the memory pool. The following example code demonstrates how to ensure that a given pointer has been successfully given back to his memory pool.
if (ememoa_mempool_fixed_push_object (&mempool_of_object, new_object)) { fprintf (stderr, "ERROR: %s", ememoa_mempool_error2string (mempool_of_object.last_error_code)); exit (-1); }
|
|
Executes fctl on all allocated data in the pool. If the execution of fctl returns something else than 0, then the walk ends and returns the error code provided by fctl.
|