Main Page | Modules | Namespace List | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages | Examples

Memory Pool Functions

Collaboration diagram for Memory Pool Functions:


Modules

 Pool Debugging functions.

Defines

#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__)
#define apr_pool_create(newpool, parent)   apr_pool_create_ex(newpool, parent, NULL, NULL)
#define apr_pool_sub_make(newpool, parent, abort_fn)   (void)apr_pool_create_ex(newpool, parent, abort_fn, NULL)
#define apr_pcalloc(p, size)   memset(apr_palloc(p, size), 0, size)

Typedefs

typedef 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_DECLARE (apr_allocator_t *) apr_pool_allocator_get(apr_pool_t *pool)
 APR_DECLARE (void *) apr_palloc(apr_pool_t *p
 APR_DECLARE (apr_abortfunc_t) apr_pool_abort_get(apr_pool_t *pool)
 APR_DECLARE (apr_pool_t *) apr_pool_parent_get(apr_pool_t *pool)
 APR_DECLARE (int) apr_pool_is_ancestor(apr_pool_t *a
const char apr_status_t(* cleanup )(void *)
const void apr_status_t(* plain_cleanup )(void *)
 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_pool_t apr_abortfunc_t
apr_allocator_t
allocator
apr_pool_t apr_abortfunc_t
apr_allocator_t const char * 
file_line
apr_size_t size
apr_pool_tpool
apr_pool_tb
const char * tag
const char * key
const char apr_status_t(* cleanup )(void *)
const void * data
const void apr_status_t(* plain_cleanup )(void *)
const void apr_status_t(*)
apr_status_t(* 
child_cleanup )(void *))

Define Documentation

#define apr_pcalloc p,
size   )     memset(apr_palloc(p, size), 0, size)
 

Allocate a block of memory from a pool and set all of the memory to 0

Parameters:
p The pool to allocate from
size The amount of memory to allocate
Returns:
The allocated memory

Definition at line 355 of file apr_pools.h.

Referenced by _file_dup(), add_ct_output_filters(), add_extension_info(), alloc_array(), alloc_socket(), ap_buffered_log_writer_init(), ap_build_config_sub(), AP_CORE_DECLARE(), AP_CORE_DECLARE_NONSTD(), AP_DECLARE(), ap_mpm_run(), ap_proxy_ftp_handler(), ap_proxy_http_handler(), ap_proxy_send_dir_filter(), ap_read_request(), apply_rewrite_rule(), apr_create_nt_pipe(), APR_DECLARE(), apr_dir_open(), APR_HOOK_STRUCT(), APR_OPTIONAL_FN_TYPE(), apr_os_dir_put(), apr_set_hour(), apr_set_mday(), apr_set_min(), apr_set_mon(), apr_set_sec(), apr_set_wday(), apr_set_year(), APU_DECLARE(), bucketeer_out_filter(), buffer_output(), cache_create_entity(), CACHE_DECLARE(), cache_save_filter(), cache_the_file(), calloc_bytes(), CaseFilterCreateServerConfig(), CaseFilterInCreateServerConfig(), cgid_init(), cgid_server(), child_main(), config_perdir_create(), config_perdir_merge(), config_server_merge(), core_create_conn(), core_create_req(), core_input_filter(), create_access_dir_config(), create_action_dir_config(), create_alias_config(), create_alias_dir_config(), create_argv(), create_autoindex_config(), create_bucketeer_server_config(), create_cache_config(), create_cgi_config(), create_cgid_config(), create_charset_dir_conf(), create_config(), create_core_server_config(), create_default_per_dir_config(), create_deflate_server_config(), create_digest_dir_config(), create_dir_config(), create_dir_expires_config(), create_echo_server_config(), create_ef_dir_conf(), create_ef_server_conf(), create_entity(), create_info_config(), create_magic_server_config(), create_proxy_config(), create_proxy_dir_config(), create_server_config(), create_uncompress_child(), create_userdir_config(), dav_add_if_resource(), dav_add_if_state(), dav_create_dir_config(), dav_create_server_config(), dav_dbm_open_direct(), DAV_DECLARE(), DAV_DECLARE_NONSTD(), dav_fs_alloc_lock(), dav_fs_append_locks(), dav_fs_create_server_config(), dav_fs_get_parent_resource(), dav_fs_get_resource(), dav_fs_load_lock_record(), dav_fs_merge_server_config(), dav_fs_open_lockdb(), dav_fs_open_stream(), dav_fs_parse_locktoken(), dav_fs_save_lock_record(), dav_merge_dir_config(), dav_merge_server_config(), dav_propdb_get_rollback(), define_filter(), deflate_in_filter(), deflate_out_filter(), dumpio_create_sconfig(), find_addresses(), find_code_page(), free_proc_chain(), get_addresses(), get_req(), htdbm_init(), htdbm_list(), includes_filter(), init_ext_filter_process(), init_filter_instance(), init_server_config(), internal_internal_redirect(), isapi_handler(), isapi_load(), isapi_lookup(), LDAP_DECLARE(), log_child(), logio_pre_conn(), make_array_core(), make_autoindex_entry(), make_child(), make_cookie_dir(), make_forensic_log_scfg(), make_parent_entry(), make_sub_request(), merge_alias_config(), merge_alias_dir_config(), merge_autoindex_configs(), merge_cache_config(), merge_charset_dir_conf(), merge_ct_filters(), merge_dir_configs(), merge_ef_dir_conf(), merge_expires_dir_configs(), merge_forensic_log_scfg(), merge_imap_dir_configs(), merge_info_config(), merge_proxy_config(), merge_proxy_dir_config(), merge_setenvif_config(), mkconfig(), mod_auth_ldap_build_filter(), mod_auth_ldap_check_user_id(), mod_auth_ldap_create_dir_config(), mod_auth_ldap_parse_url(), mva_create_server_config(), mva_merge_server_config(), nwssl_post_config(), open_entity(), original_uri(), parse(), parse_accept_headers(), parse_hdr_and_update_nc(), perchild_create_config(), perchild_post_config(), perchild_pre_config(), prep_walk_cache(), prepare(), PROXY_DECLARE(), re_check(), read_write_notimeout(), recv_msg(), rewritemap_program_child(), run_cgi_child(), set_error_document(), set_secure_listener(), set_secure_upgradeable_listener(), so_sconf_create(), ssl_init_connection_ctx(), ssl_pipe_child_create(), ssl_util_ppopen(), ssl_util_ptxtsub(), ssl_var_lookup_ssl_cert_PEM(), ssl_var_lookup_ssl_cert_serial(), ssl_var_lookup_ssl_cert_valid(), start_handler(), start_threads(), test_create_proc(), test_file_redir(), test_read(), test_seek(), testdso(), util_ldap_create_config(), x_create_dir_config(), x_create_server_config(), x_merge_dir_config(), x_merge_server_config(), xlate_in_filter(), and xlate_out_filter().

#define APR_POOL__FILE_LINE__   __FILE__ ":" APR_STRINGIFY(__LINE__)
 

the place in the code where the particular function was called

Definition at line 136 of file apr_pools.h.

#define apr_pool_create newpool,
parent   )     apr_pool_create_ex(newpool, parent, NULL, NULL)
 

Create a new pool.

Parameters:
newpool The pool we have just created.
parent The parent pool. If this is NULL, the new pool is a root pool. If it is non-NULL, the new pool will inherit all of its parent pool's attributes, except the apr_pool_t will be a sub-pool.

Definition at line 235 of file apr_pools.h.

Referenced by ap_core_reorder_directories(), ap_mpm_child_main(), ap_mpm_run(), ap_read_request(), APR_OPTIONAL_FN_TYPE(), apr_thread_create(), cgid_server(), cgid_start(), check_speling(), child_main(), child_pool(), create_process(), dav_method_propfind(), dav_send_multistatus(), groups_for_user(), htdbm_init(), includes_filter(), init_cache(), main(), make_sub_request(), make_worker(), open_scoreboard(), output_directories(), parent_pool(), setup_module_cells(), sort_hook(), start_connect(), testud(), trace_add(), uncompress(), and worker_thread().

#define APR_POOL_DEBUG   0
 

Pool debug levels

 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
 ---------------------------------
 |   |   |   |   |   |   |   | x |  General debug code enabled (usefull in
                                    combination with --with-efence).

 |   |   |   |   |   |   | x |   |  Verbose output on stderr (report
                                    CREATE, CLEAR, DESTROY).

 |   |   |   | x |   |   |   |   |  Verbose output on stderr (report
                                    PALLOC, PCALLOC).

 |   |   |   |   |   | x |   |   |  Lifetime checking. On each use of a
                                    pool, check its lifetime.  If the pool
                                    is out of scope, abort().
                                    In combination with the verbose flag
                                    above, it will output LIFE in such an
                                    event prior to aborting.

 |   |   |   |   | x |   |   |   |  Pool owner checking.  On each use of a
                                    pool, check if the current thread is the
                                    pools owner.  If not, abort().  In
                                    combination with the verbose flag above,
                                    it will output OWNER in such an event
                                    prior to aborting.  Use the debug
                                    function apr_pool_owner_set() to switch
                                    a pools ownership.

 When no debug level was specified, assume general debug mode.
 If level 0 was specified, debugging is switched off
 

Definition at line 132 of file apr_pools.h.

#define APR_POOL_DECLARE_ACCESSOR type   ) 
 

Value:

APR_DECLARE(apr_pool_t *) apr_##type##_pool_get \
        (const apr_##type##_t *the##type)
Declaration helper macro to construct apr_foo_pool_get()s.

This standardized macro is used by opaque (APR) data types to return the apr_pool_t that is associated with the data type.

APR_POOL_DECLARE_ACCESSOR() is used in a header file to declare the accessor function. A typical usage and result would be:

    APR_POOL_DECLARE_ACCESSOR(file);
 becomes:
    APR_DECLARE(apr_pool_t *) apr_file_pool_get(apr_file_t *ob);
 
Remarks:
Doxygen unwraps this macro (via doxygen.conf) to provide actual help for each specific occurance of apr_foo_pool_get.

the linkage is specified for APR. It would be possible to expand the macros to support other linkages.

Definition at line 75 of file apr_pools.h.

#define APR_POOL_IMPLEMENT_ACCESSOR type   ) 
 

Value:

APR_DECLARE(apr_pool_t *) apr_##type##_pool_get \
            (const apr_##type##_t *the##type) \
        { return the##type->pool; }
Implementation helper macro to provide apr_foo_pool_get()s.

In the implementation, the APR_POOL_IMPLEMENT_ACCESSOR() is used to actually define the function. It assumes the field is named "pool".

Definition at line 85 of file apr_pools.h.

#define apr_pool_sub_make newpool,
parent,
abort_fn   )     (void)apr_pool_create_ex(newpool, parent, abort_fn, NULL)
 

Deprecated:
See also:
apr_pool_create_ex

Definition at line 247 of file apr_pools.h.

Referenced by isapi_pre_config(), service_stderr_thread(), ssl_scache_dbm_expire(), and ssl_scache_dbm_kill().


Typedef Documentation

typedef int(* apr_abortfunc_t)(int retcode)
 

A function that is called when allocation fails.

Definition at line 141 of file apr_pools.h.

void(*) p void apr_file_t apr_pool_t)
 

The fundamental pool type

Definition at line 54 of file apr_pools.h.


Function Documentation

APR_DECLARE int   ) 
 

Determine if pool a is an ancestor of pool b

Parameters:
a The pool to search
b The pool to search for
Returns:
True if a is an ancestor of b, NULL is considered an ancestor of all pools.

APR_DECLARE apr_pool_t  ) 
 

Get the current owner of the allocator

Parameters:
allocator The allocator to get the owner from

Definition at line 137 of file apr_pools.c.

APR_DECLARE apr_abortfunc_t   ) 
 

Get the abort function associated with the specified pool.

Parameters:
pool The pool for retrieving the abort function.
Returns:
The abort function for the given pool.

Definition at line 2220 of file apr_pools.c.

APR_DECLARE void *   ) 
 

Allocate a block of memory from a pool

Parameters:
p The pool to allocate from
size The amount of memory to allocate
Returns:
The allocated memory

Definition at line 665 of file apr_pools.c.

APR_DECLARE apr_allocator_t  ) 
 

Find the pools allocator

Parameters:
pool The pool to get the allocator from.

Definition at line 1763 of file apr_pools.c.

APR_DECLARE void   ) 
 

Register an other_child -- a child associated to its registered maintence callback. This callback is invoked when the process dies, is disconnected or disappears.

Parameters:
proc The child process to register.
maintenance maintenance is a function that is invoked with a reason and the data pointer passed here.
data Opaque context data passed to the maintenance function.
write_fd An fd that is probed for writing. If it is ever unwritable then the maintenance is invoked with reason OC_REASON_UNWRITABLE.
p The pool to use for allocating memory.
Bug:
write_fd duplicates the proc->out stream, it's really redundant and should be replaced in the APR 1.0 API with a bitflag of which proc->in/out/err handles should be health checked.

no platform currently tests the pipes health.

Definition at line 131 of file apr_pools.c.

APR_DECLARE apr_status_t   ) 
 

convert an ansi time_t to an apr_time_t

Parameters:
result the resulting apr_time_t
input the time_t to convert

Definition at line 24 of file netware/dso.c.

APR_DECLARE_NONSTD apr_status_t   ) 
 

An empty cleanup function

Parameters:
data The data to cleanup

Definition at line 1992 of file apr_pools.c.

const char apr_status_t(* cleanup void *   ) 
 

const void apr_status_t(* plain_cleanup void *   ) 
 


Variable Documentation

apr_pool_t apr_abortfunc_t abort_fn
 

Definition at line 207 of file apr_pools.h.

apr_pool_t apr_abortfunc_t apr_allocator_t * allocator
 

Definition at line 207 of file apr_pools.h.

Referenced by APU_DECLARE_NONSTD(), child_main(), listener_thread(), worker_main(), and worker_thread().

apr_pool_t* b
 

Definition at line 421 of file apr_pools.h.

const void apr_status_t(*) apr_status_t(* child_cleanup)(void *))
 

Definition at line 538 of file apr_pools.h.

void apr_status_t(* cleanup)(void *))
 

Definition at line 550 of file apr_pools.h.

void* data
 

Definition at line 549 of file apr_pools.h.

apr_size_t const char * file_line
 

Definition at line 366 of file apr_pools.h.

const char* key
 

Definition at line 490 of file apr_pools.h.

apr_pool_t * parent
 

Definition at line 207 of file apr_pools.h.

const void apr_status_t(* plain_cleanup)(void *)
 

const char apr_pool_t* pool
 

Definition at line 490 of file apr_pools.h.

apr_size_t size
 

Definition at line 366 of file apr_pools.h.

const char* tag
 

Definition at line 428 of file apr_pools.h.