On Fri, 04 Jun 2010 15:36:22 -0400
"Mikhail T." <[email protected]> wrote:

> My module, at least, is using some external libraries, so I can't rely 
> on the apr_pools for clean-ups. How do I know, when to free-up the 
> resources I've allocated?

I'm guessing that's the crux of your question.

The answer is, yes you can and should use APR pools.  The basic principle is,
whenever you allocate something, you register a cleanup on the appropriate
pool at the same time, typically with something like:

  foo = libfoo_alloc( ... );
  apr_pool_cleanup_register(pool, foo, libfoo_free, apr_pool_cleanup_null);

(add wrappers where necessary, etc)

-- 
Nick Kew

Reply via email to