summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPranith Kumar K <pkarampu@redhat.com>2014-05-21 22:37:13 +0530
committerVijay Bellur <vbellur@redhat.com>2014-05-22 23:48:01 -0700
commit9ce93bc3be1dd5a5caecbb45966bc6b7b8e2c32b (patch)
tree0660c543b60ae5bf7034bf5bb4f2f1e267581751
parent0127da7bb24794e737adc5a3195d3c54a175257f (diff)
libglusterfs: Provide a way to disable mempool effects
Problems: - Mempool comes in the way of debugging mem-leaks/corruptions because tools like valgrind can't detect mem-pools. - Accessing freed pointers may crash only when the mem-pool is completely exhausted. Solution: In DEBUG builds set mempool count to 0 irrespective of the pool size requested. This should help in debugging memory-leaks/corruptions. Change-Id: I7c6a2d696e330f12acff57ebdc589cc150e9ab79 BUG: 1100144 Signed-off-by: Pranith Kumar K <pkarampu@redhat.com> Reviewed-on: http://review.gluster.org/7835 Reviewed-by: Xavier Hernandez <xhernandez@datalab.es> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
-rw-r--r--libglusterfs/src/mem-pool.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libglusterfs/src/mem-pool.c b/libglusterfs/src/mem-pool.c
index b233995b0b1..6207e995bc3 100644
--- a/libglusterfs/src/mem-pool.c
+++ b/libglusterfs/src/mem-pool.c
@@ -314,9 +314,10 @@ mem_pool_new_fn (unsigned long sizeof_type,
INIT_LIST_HEAD (&mem_pool->global_list);
mem_pool->padded_sizeof_type = padded_sizeof_type;
- mem_pool->cold_count = count;
mem_pool->real_sizeof_type = sizeof_type;
+#ifndef DEBUG
+ mem_pool->cold_count = count;
pool = GF_CALLOC (count, padded_sizeof_type, gf_common_mt_long);
if (!pool) {
GF_FREE (mem_pool->name);
@@ -332,6 +333,7 @@ mem_pool_new_fn (unsigned long sizeof_type,
mem_pool->pool = pool;
mem_pool->pool_end = pool + (count * (padded_sizeof_type));
+#endif
/* add this pool to the global list */
ctx = THIS->ctx;