]> git.saurik.com Git - redis.git/commitdiff
define zlibc_free() in a way that is not shadowed by jemalloc.
authorantirez <antirez@gmail.com>
Tue, 27 Mar 2012 14:54:53 +0000 (16:54 +0200)
committerantirez <antirez@gmail.com>
Wed, 28 Mar 2012 11:18:29 +0000 (13:18 +0200)
src/zmalloc.c

index 5e5598cf1ce7a28c86daaaf3fcfcceb373786d9a..79b56158613b5faf893af0670f0cea98bc2a8810 100644 (file)
 
 #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