summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--configure.ac6
-rw-r--r--libglusterfs/src/mem-pool.c10
2 files changed, 16 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 713e5ada83d..d303cb69899 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1113,6 +1113,12 @@ AC_ARG_ENABLE([debug],
AC_HELP_STRING([--enable-debug],
[Enable debug build options.]))
+AC_ARG_ENABLE([mempool],
+ AC_HELP_STRING([--disable-mempool],
+ [Disable the Gluster memory pooler.]))
+if test "x$enable_mempool" = "xno"; then
+ CFLAGS="${CFLAGS} -DDISABLE_MEMPOOL"
+fi
# syslog section
AC_ARG_ENABLE([syslog],
diff --git a/libglusterfs/src/mem-pool.c b/libglusterfs/src/mem-pool.c
index 78fecec4b0f..40e80d5c33e 100644
--- a/libglusterfs/src/mem-pool.c
+++ b/libglusterfs/src/mem-pool.c
@@ -450,6 +450,10 @@ mem_get0 (struct mem_pool *mem_pool)
void *
mem_get (struct mem_pool *mem_pool)
{
+#ifdef DISABLE_MEMPOOL
+ return GF_CALLOC (1, mem_pool->real_sizeof_type,
+ gf_common_mt_mem_pool);
+#else
struct list_head *list = NULL;
void *ptr = NULL;
int *in_use = NULL;
@@ -521,6 +525,7 @@ fwd_addr_out:
UNLOCK (&mem_pool->lock);
return ptr;
+#endif /* DISABLE_MEMPOOL */
}
@@ -547,6 +552,10 @@ __is_member (struct mem_pool *pool, void *ptr)
void
mem_put (void *ptr)
{
+#ifdef DISABLE_MEMPOOL
+ GF_FREE (ptr);
+ return;
+#else
struct list_head *list = NULL;
int *in_use = NULL;
void *head = NULL;
@@ -624,6 +633,7 @@ mem_put (void *ptr)
}
}
UNLOCK (&pool->lock);
+#endif /* DISABLE_MEMPOOL */
}
void