From b3c068ccd9125ffdfb6fbb3d2728f16ff8dda2eb Mon Sep 17 00:00:00 2001 From: Niels de Vos Date: Tue, 29 Aug 2017 00:17:03 +0200 Subject: mem-pool: count allocations done per user-pool Count the active allocations per 'struct mem_pool'. These are the objects that the calling component allocated and free'd in the memory pool for this specific type. Having this count in the statedump will make it easy to find memory leaks. Updates: #307 Change-Id: I797fabab86f104e49338c00e449a7d0b0d270004 Signed-off-by: Niels de Vos Reviewed-on: https://review.gluster.org/18074 Smoke: Gluster Build System CentOS-regression: Gluster Build System Reviewed-by: Jeff Darcy --- libglusterfs/src/mem-pool.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'libglusterfs/src/mem-pool.h') diff --git a/libglusterfs/src/mem-pool.h b/libglusterfs/src/mem-pool.h index ecf2abe9245..ff5d183b16d 100644 --- a/libglusterfs/src/mem-pool.h +++ b/libglusterfs/src/mem-pool.h @@ -209,8 +209,9 @@ out: struct mem_pool { /* object size, without pooled_obj_hdr_t */ unsigned long sizeof_type; - unsigned long count; + unsigned long count; /* requested pool size (unused) */ char *name; + gf_atomic_t active; /* current allocations */ struct list_head owner; /* glusterfs_ctx_t->mempool_list */ glusterfs_ctx_t *ctx; /* take ctx->lock when updating owner */ -- cgit