Functions | |
int | ememoa_mempool_unknown_size_init (struct ememoa_mempool_unknown_size_s *memory, unsigned int map_items_count, const unsigned int *map_size_count, unsigned int options, const struct ememoa_mempool_desc_s *desc) |
Initializes a memory pool structure for later use. | |
int | ememoa_mempool_unknown_size_clean (struct ememoa_mempool_unknown_size_s *memory) |
Destroys all allocated objects of the memory pool and uninitialize it. | |
int | ememoa_mempool_unknown_size_free_all_objects (struct ememoa_mempool_unknown_size_s *memory) |
Destroys all allocated object of the memory pool. | |
int | ememoa_mempool_unknown_size_push_object (struct ememoa_mempool_unknown_size_s *memory, void *ptr) |
Push back an object in the memory pool. | |
void * | ememoa_mempool_unknown_size_pop_object (struct ememoa_mempool_unknown_size_s *memory, unsigned int size) |
Pops a new object out of the memory pool. | |
int | ememoa_mempool_unknown_size_garbage_collect (struct ememoa_mempool_unknown_size_s *memory) |
Collects all the empty pool and resize the Mempool accordingly. | |
int | ememoa_mempool_unknown_size_walk_over (struct ememoa_mempool_unknown_size_s *memory, ememoa_fctl fctl, void *data) |
Execute fctl on all allocated data in the pool. |
|
Destroys all allocated objects of the memory pool and uninitialize it. The memory pool is unusable after the call of the function. The following example code demonstrate how to ensure that a given memory pool has been successfully destroyed
if (ememoa_mempool_unknown_size_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 resize the Mempool accordingly. The following example code demonstrate how to ensure that a given Mempool give some memory back 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_unknown_size_s test_pool; if (ememoa_mempool_unknown_size_init (&test_pool, sizeof(default_map_size_count)/(sizeof(unsigned int) * 2), default_map_size_count, 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 retrived from the memory pool.
object_s *new_object = ememoa_mempool_unknown_size_pop_object (&mempool_of_object, 100); 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 demonstrate how to ensure that a given pointer has been successfully given back to his memory pool.
if (ememoa_mempool_unknown_size_push_object (&mempool_of_object, new_object)) { fprintf (stderr, "ERROR: %s", ememoa_mempool_error2string (mempool_of_object.last_error_code)); exit (-1); }
|
|
Execute fctl on all allocated data in the pool. If the execution of fctl something else than 0, then the walk ends and returns the error code provided by fctl.
|