diff options
Diffstat (limited to 'libc/bionic/malloc_debug_common.cpp')
-rw-r--r-- | libc/bionic/malloc_debug_common.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/libc/bionic/malloc_debug_common.cpp b/libc/bionic/malloc_debug_common.cpp index 9399237fb..be16625b8 100644 --- a/libc/bionic/malloc_debug_common.cpp +++ b/libc/bionic/malloc_debug_common.cpp @@ -46,6 +46,16 @@ #include "private/ScopedPthreadMutexLocker.h" +#if defined(USE_JEMALLOC) +#include "jemalloc.h" +#define Malloc(function) je_ ## function +#elif defined(USE_DLMALLOC) +#include "dlmalloc.h" +#define Malloc(function) dl ## function +#else +#error "Either one of USE_DLMALLOC or USE_JEMALLOC must be defined." +#endif + // In a VM process, this is set to 1 after fork()ing out of zygote. int gMallocLeakZygoteChild = 0; @@ -408,7 +418,7 @@ static void malloc_init_impl() { dlclose(malloc_impl_handle); return; } - if (!malloc_debug_initialize(&g_hash_table)) { + if (!malloc_debug_initialize(&g_hash_table, &__libc_malloc_default_dispatch)) { dlclose(malloc_impl_handle); return; } |