The memory is allocated on a pool.
The memory is not freed manually for each object allocated on a pool. Instead, the memory for all objects allocated on the pool is getting freed when the pool is destroyed (using apr_pool_destroy). This is why the pools are getting used in the first place in apr, so that you don't have to free the memory allocated for each object individually, but to destroy the pool and all the objects allocated on it will be freed at once.


--- On Thu, 5/29/08, Marc Mongenet <marc@mongenet.ch> wrote:
From: Marc Mongenet <marc@mongenet.ch>
Subject: apr_thread_mutex_destroy not freeing memory
To: dev@apr.apache.org
Date: Thursday, May 29, 2008, 11:09 PM


I think that apr_thread_mutex_destroy does not free the memory
allocated in apr_thread_mutex_create (on unix, and also on win32 I think).

static apr_status_t thread_mutex_cleanup(void *data)
apr_thread_mutex_t *mutex = data;
apr_status_t rv;

rv = pthread_mutex_destroy(&mutex->mutex);
if (rv) {
rv = errno;
return rv;

APR_DECLARE(apr_status_t) apr_thread_mutex_create(apr_thread_mutex_t **mutex,
unsigned int flags,
apr_pool_t *pool)
/* ................... */

new_mutex = apr_pcalloc(pool, sizeof(apr_thread_mutex_t));
new_mutex->pool = pool;

/* ................... */

Marc Mongenet