Defines |
#define | APR_WANT_MEMFUNC |
#define | APR_POOL_DECLARE_ACCESSOR(type) |
#define | APR_POOL_IMPLEMENT_ACCESSOR(type) |
#define | APR_POOL_DEBUG 0 |
#define | APR_POOL__FILE_LINE__ __FILE__ ":" APR_STRINGIFY(__LINE__) |
Typedefs |
typedef struct apr_pool_t | apr_pool_t |
typedef int(* | apr_abortfunc_t )(int retcode) |
Functions |
apr_status_t | apr_pool_initialize (void) |
void | apr_pool_terminate (void) |
apr_status_t | apr_pool_create_ex (apr_pool_t **newpool, apr_pool_t *parent, apr_abortfunc_t abort_fn, apr_allocator_t *allocator) |
apr_status_t | apr_pool_create_core_ex (apr_pool_t **newpool, apr_abortfunc_t abort_fn, apr_allocator_t *allocator) |
apr_status_t | apr_pool_create_unmanaged_ex (apr_pool_t **newpool, apr_abortfunc_t abort_fn, apr_allocator_t *allocator) |
apr_status_t | apr_pool_create_ex_debug (apr_pool_t **newpool, apr_pool_t *parent, apr_abortfunc_t abort_fn, apr_allocator_t *allocator, const char *file_line) |
apr_status_t | apr_pool_create_core_ex_debug (apr_pool_t **newpool, apr_abortfunc_t abort_fn, apr_allocator_t *allocator, const char *file_line) |
apr_status_t | apr_pool_create_unmanaged_ex_debug (apr_pool_t **newpool, apr_abortfunc_t abort_fn, apr_allocator_t *allocator, const char *file_line) |
apr_status_t | apr_pool_create (apr_pool_t **newpool, apr_pool_t *parent) |
apr_status_t | apr_pool_create_core (apr_pool_t **newpool) |
apr_status_t | apr_pool_create_unmanaged (apr_pool_t **newpool) |
apr_allocator_t * | apr_pool_allocator_get (apr_pool_t *pool) |
void | apr_pool_clear (apr_pool_t *p) |
void | apr_pool_clear_debug (apr_pool_t *p, const char *file_line) |
void | apr_pool_destroy (apr_pool_t *p) |
void | apr_pool_destroy_debug (apr_pool_t *p, const char *file_line) |
void * | apr_palloc (apr_pool_t *p, apr_size_t size) |
void * | apr_palloc_debug (apr_pool_t *p, apr_size_t size, const char *file_line) |
void * | apr_pcalloc (apr_pool_t *p, apr_size_t size) |
void * | apr_pcalloc_debug (apr_pool_t *p, apr_size_t size, const char *file_line) |
void | apr_pool_abort_set (apr_abortfunc_t abortfunc, apr_pool_t *pool) |
apr_abortfunc_t | apr_pool_abort_get (apr_pool_t *pool) |
apr_pool_t * | apr_pool_parent_get (apr_pool_t *pool) |
int | apr_pool_is_ancestor (apr_pool_t *a, apr_pool_t *b) |
void | apr_pool_tag (apr_pool_t *pool, const char *tag) |
apr_status_t | apr_pool_userdata_set (const void *data, const char *key, apr_status_t(*cleanup)(void *), apr_pool_t *pool) |
apr_status_t | apr_pool_userdata_setn (const void *data, const char *key, apr_status_t(*cleanup)(void *), apr_pool_t *pool) |
apr_status_t | apr_pool_userdata_get (void **data, const char *key, apr_pool_t *pool) |
void | apr_pool_cleanup_register (apr_pool_t *p, const void *data, apr_status_t(*plain_cleanup)(void *), apr_status_t(*child_cleanup)(void *)) |
void | apr_pool_pre_cleanup_register (apr_pool_t *p, const void *data, apr_status_t(*plain_cleanup)(void *)) |
void | apr_pool_cleanup_kill (apr_pool_t *p, const void *data, apr_status_t(*cleanup)(void *)) |
void | apr_pool_child_cleanup_set (apr_pool_t *p, const void *data, apr_status_t(*plain_cleanup)(void *), apr_status_t(*child_cleanup)(void *)) |
apr_status_t | apr_pool_cleanup_run (apr_pool_t *p, void *data, apr_status_t(*cleanup)(void *)) |
apr_status_t | apr_pool_cleanup_null (void *data) |
void | apr_pool_cleanup_for_exec (void) |
void | apr_pool_join (apr_pool_t *p, apr_pool_t *sub) |
apr_pool_t * | apr_pool_find (const void *mem) |
apr_size_t | apr_pool_num_bytes (apr_pool_t *p, int recurse) |
void | apr_pool_lock (apr_pool_t *pool, int flag) |
APR memory allocation.
Resource allocation routines...
designed so that we don't have to keep track of EVERYTHING so that it can be explicitly freed later (a fundamentally unsound strategy --- particularly in the presence of die()).
Instead, we maintain pools, and allocate items (both memory and I/O handlers) from the pools --- currently there are two, one for per-transaction info, and one for config info. When a transaction is over, we can delete everything in the per-transaction apr_pool_t without fear, and without thinking too hard about it either.
Note that most operations on pools are not thread-safe: a single pool should only be accessed by a single thread at any given time. The one exception to this rule is creating a subpool of a given pool: one or more threads can safely create subpools at the same time that another thread accesses the parent pool.