mod_annot editor

Annotate Section

Using Pools in Apache: Initialisation and Configuration

The internals of Apache's initialisation are complex. But as far as modules are concerned, it can normally be treated as simple: you are just setting up your configuration, and everything is permanent. Apache makes that easy: most of the relevant hooks have prototypes that pass you the relevant pool as their first argument:

Configuration handlers

static const char* my_cfg(cmd_parms* cmd, void* cfg, /* args */ ) Use the configuration pool, cmd->pool to give your configuration the lifetime of the directive.

Pre- and Post-config

These hooks are unusual in having several pools passed: static int my_pre_config(apr_pool_t* pool, apr_pool_t* plog,apr_pool_t* ptemp). For most purposes, just use the first pool, but if your function uses pools for temporary resources within itself, use ptemp.

Child init

static void my_child_init(apr_pool_t* pool, server_rec* s). Again, the pool is the first argument.