On Thu, Jan 11, 2018 at 3:55 AM, Simon Walter <simon@xxxxxxxxxx> wrote: > Hi everyone, > > Am I correct to assume that a pool cannot be forcibly (prematurely) > freed? I was trying to understand apr_hash and wanted to free the memory > allocated for the keys and then try a apr_hash_get. You know, put it > through it's paces ;) apr_pool_destroy should do this. > > I read about apr_pool_clear: > "This does not actually free the memory, it just allows the pool to > re-use this memory for the next allocation." > but about apr_pool_destroy: > "This will actually free the memory" > > However, when I run this simple program through valgrind, there are no > memory errors. > > I suppose that the pool is keeping track of all it's allocations and if > something is still referenced, it will not free it. No the only tracking is done by whoever manages the lifecycle of the pool itself -- no magic. apr_pool_destroy will call free() or munmap or any underlying allocation on the way out, returning it to the OS. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx