Now that we have covered the main structures used by modules, we can detail the functions available to use and manipulate those structures.
14.6.1. Pool Functions
|ap_make_sub_pool||create a subpool|
pool *ap_make_sub_pool(pool *p)
Creates a subpool within a pool. The subpool is destroyed automatically when the pool p is destroyed, but can also be destroyed earlier with destroy_pool or cleared with clear_pool. Returns the new pool.
|ap_clear_pool||clear a pool without destroying it|
void ap_clear_pool(pool *p)
Clears a pool, destroying all its subpools with destroy_pool and running cleanups. This leaves the pool itself empty but intact, and therefore available for reuse.
|ap_destroy_pool||destroy a pool and all its contents|
void ap_destroy_pool(pool *p)
Destroys a pool, running cleanup methods for the contents and also destroying all subpools. The subpools are destroyed before the pool's cleanups are run.
|ap_bytes_in_pool||report the size of a pool|
long ap_bytes_in_pool(pool *p)
Returns the number of bytes currently allocated to a pool.
|ap_bytes_in_free_blocks||report the total size of free blocks in the pool system|
Returns the number of bytes currently in free blocks for all pools.
|ap_palloc||allocate memory within a pool|
void *ap_palloc(pool *p, int size)
Allocates memory of at least size bytes. The memory is destroyed when the pool is destroyed. Returns a pointer to the new block of memory.
|ap_pcalloc||allocate and clear memory within a pool|
void *ap_pcalloc(pool ...