mem-pool,io-threads: Destroy mem-pool on deallocation

Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
This commit is contained in:
Shehjar Tikoo 2009-05-21 01:37:05 +00:00 committed by Anand V. Avati
parent ef7fcc0d7c
commit c7fd9f1df3
3 changed files with 17 additions and 0 deletions

View File

@ -197,3 +197,17 @@ mem_put (struct mem_pool *pool, void *ptr)
}
UNLOCK (&pool->lock);
}
void
mem_pool_destroy (struct mem_pool *pool)
{
if (!pool)
return;
LOCK_DESTROY (&pool->lock);
FREE (pool->pool);
FREE (pool);
return;
}

View File

@ -52,4 +52,6 @@ mem_pool_new_fn (unsigned long sizeof_type, unsigned long count);
void mem_put (struct mem_pool *pool, void *ptr);
void *mem_get (struct mem_pool *pool);
void mem_pool_destroy (struct mem_pool *pool);
#endif /* _MEM_POOL_H */

View File

@ -2563,6 +2563,7 @@ deallocate_workers (iot_worker_t **workers,
end_count = count + start_alloc_idx;
for (i = start_alloc_idx; (i < end_count); i++) {
if (workers[i] != NULL) {
mem_pool_destroy (workers[i]->req_pool);
FREE (workers[i]);
workers[i] = NULL;
}