mem-pool,io-threads: Destroy mem-pool on deallocation
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
This commit is contained in:
parent
ef7fcc0d7c
commit
c7fd9f1df3
@ -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;
|
||||
}
|
||||
|
@ -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 */
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user