apr  1.7.0
About: APR (Apache Portable Runtime) project offers software libraries that provide a predictable and consistent interface to underlying platform-specific implementations (APR core library).
  Fossies Dox: apr-1.7.0.tar.bz2  ("inofficial" and yet experimental doxygen-generated source code documentation)  

apr_pools.h File Reference

APR memory allocation. More...

#include "apr.h"
#include "apr_errno.h"
#include "apr_general.h"
#include "apr_want.h"
#include "apr_allocator.h"
Include dependency graph for apr_pools.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define APR_WANT_MEMFUNC
 
#define APR_POOL_DECLARE_ACCESSOR(type)
 
#define APR_POOL_IMPLEMENT_ACCESSOR(type)
 
#define APR_POOL__FILE_LINE__   __FILE__ ":" APR_STRINGIFY(__LINE__)
 
#define apr_pool_create(newpool, parent)   apr_pool_create_ex(newpool, parent, NULL, NULL)
 
#define apr_pool_create_core(newpool)   apr_pool_create_unmanaged_ex(newpool, NULL, NULL)
 
#define apr_pool_create_unmanaged(newpool)   apr_pool_create_unmanaged_ex(newpool, NULL, NULL)
 
#define apr_pcalloc(p, size)   memset(apr_palloc(p, size), 0, size)
 
#define apr_pool_join(a, b)
 
#define apr_pool_lock(pool, lock)
 

Typedefs

typedef struct apr_pool_t apr_pool_t
 
typedef int(* apr_abortfunc_t) (int retcode)
 

Functions

 APR_DECLARE (apr_status_t) apr_pool_initialize(void)
 
 APR_DECLARE (void) apr_pool_terminate(void)
 
apr_pool_t apr_abortfunc_t apr_allocator_t *allocator __attribute__ ((nonnull(1)))
 
 APR_DECLARE (apr_allocator_t *) apr_pool_allocator_get(apr_pool_t *pool) __attribute__((nonnull(1)))
 
 APR_DECLARE (void *) apr_palloc(apr_pool_t *p
 
apr_pool_t *pool __attribute__ ((nonnull(2)))
 
 APR_DECLARE (apr_abortfunc_t) apr_pool_abort_get(apr_pool_t *pool) __attribute__((nonnull(1)))
 
 APR_DECLARE (apr_pool_t *) apr_pool_parent_get(apr_pool_t *pool) __attribute__((nonnull(1)))
 
const char apr_pool_t *pool __attribute__ ((nonnull(1, 2, 3)))
 
 APR_DECLARE_NONSTD (apr_status_t) apr_pool_cleanup_null(void *data)
 

Variables

apr_pool_tparent
 
apr_pool_t apr_abortfunc_t abort_fn
 
apr_abortfunc_t apr_allocator_tallocator
 
apr_abortfunc_t apr_allocator_t const char * file_line
 
apr_size_t size
 
apr_pool_tb
 
const char * key
 
const char apr_status_t(* cleanup )(void *)
 
const char apr_status_t(*) apr_pool_t *poo __attribute__ )((nonnull(2, 4)))
 
const void * data
 
const void apr_status_t(* plain_cleanup )(void *)
 
const void apr_status_t(*) apr_status_t(* child_cleanup )(void *)) __attribute__((nonnull(3
 
const void apr_status_t(*) apr_status_t(* APR_DECLARE )(void) apr_pool_pre_cleanup_register(apr_pool_t *p
 

Detailed Description

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.

Definition in file apr_pools.h.

Macro Definition Documentation

◆ APR_WANT_MEMFUNC

#define APR_WANT_MEMFUNC

for no good reason?

Definition at line 46 of file apr_pools.h.