Hello,
Quite a while ago I began migration a C-Application to use APR, first
for file-io / locking only ( now also memory management and error-
handling ).
Since it is not really easy to integrate apr memory-management into
an existing application ( changing all the function signatures to
take and apr-pool etc. ) there are still some few functions, that
create an apr-pool with NULL as parent-parameter.
This works nice, until I was playing around with
apr_pool_cleanup_register to free memory allocated on the heap by
other library methods.
In the Unit-tests I got application crashes (double free), which can
generally be traced back to apr_terminate calling cleanup-methods,
that were already called by apr_pool_destroy before, but _ONLY_, if
there is more than one root-pool created.
So my question is: Is it to be generally considered dangerous to have
more than one root-pool in an application, or might there be another
problem in my application, that I have to spend some extra-thinking
on (this stuff is disgustingly hard to debug ;)?
Greetings
Sebastian
|