The APR Pools
The APR pools provide an alternative model for resource management.
Like garbage collection, they liberate the programmer from the
complexities of dealing with cleanups in all possible cases.
But they offer several additional advantages, including full
control over the lifetime of resources, and the ability to manage
heterogenous resources.
The basic concept is that whenever you allocate a resource that
requires cleanup, you register it with a pool. The pool then
takes responsibility for the cleanup, which will happen when the
pool itself is cleaned. That means that the problem is reduced
to one of allocating and cleaning up a single resource: the pool
itself. And since the Apache pools are managed by the server
itself, the complexity is removed from applications programming.
All the programmer has to do is select the appropriate pool for
the required lifetime of a resource.