This module contains functions and macros related to dynamic memory management.
#define POOL_GROW_AMOUNT 16 |
Amount to grow object pool dynamically during add if no free slots remain
Adds an object to the memory pool.
- Parameters
-
ptr | a pointer to the object to be added |
- Returns
- The new total number of objects in the memory pool
Frees any memory allocated for objects stored in the memory pool.
- Returns
- The number of freed objects
- Examples:
- daemon.c.
Initialize a memory pool with the specified size.
- Parameters
-
initial_size | initial size of the memory pool |
- Returns
- Success or failure
SLD_BOOL sld_memory_pool_initialized |
( |
| ) |
|
Checks whether or not the memory pool is initialized.
- Returns
- True or false
void sld_memory_pool_nuke |
( |
| ) |
|
Returns the total number of objects in the memory pool.
- Returns
- The total number of objects in the memory pool
puts("We can shove more into the memory pool!");
Resizes the memory pool to the specified size.
- Parameters
-
new_size | the new size of the memory pool |
- Returns
- Success or failure
Returns the size of the memory pool.
- Returns
- The size of the memory pool
puts("We need to resize the memory pool!");