summaryrefslogtreecommitdiff
path: root/src/zmalloc.c
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2012-03-27 16:54:53 +0200
committerantirez <antirez@gmail.com>2012-03-27 16:54:53 +0200
commitd174eed5d7496b6af767f9c814d93832e9be0c3a (patch)
tree6684d37c4c165fb70f20a56a167385b8bb9b75b2 /src/zmalloc.c
parent23c0cdd2ad8b15defab56eca89a42c67cadd9a34 (diff)
downloadredis-d174eed5d7496b6af767f9c814d93832e9be0c3a.tar.gz
define zlibc_free() in a way that is not shadowed by jemalloc.
Diffstat (limited to 'src/zmalloc.c')
-rw-r--r--src/zmalloc.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/zmalloc.c b/src/zmalloc.c
index 5e5598cf1..79b561586 100644
--- a/src/zmalloc.c
+++ b/src/zmalloc.c
@@ -30,6 +30,15 @@
#include <stdio.h>
#include <stdlib.h>
+
+/* This function provide us access to the original libc free(). This is useful
+ * for instance to free results obtained by backtrace_symbols(). We need
+ * to define this function before including zmalloc.h that may shadow the
+ * free implementation if we use jemalloc or another non standard allocator. */
+void zlibc_free(void *ptr) {
+ free(ptr);
+}
+
#include <string.h>
#include <pthread.h>
#include "config.h"
@@ -227,10 +236,6 @@ void zmalloc_enable_thread_safeness(void) {
zmalloc_thread_safe = 1;
}
-void zlibc_free(void *ptr) {
- free(ptr);
-}
-
/* Get the RSS information in an OS-specific way.
*
* WARNING: the function zmalloc_get_rss() is not designed to be fast