diff options
author | Christopher Ferris <cferris@google.com> | 2014-05-08 11:14:03 -0700 |
---|---|---|
committer | Christopher Ferris <cferris@google.com> | 2014-05-20 14:47:33 -0700 |
commit | 72bbd423579bb971dc06cdd3c06201faf3fe95e6 (patch) | |
tree | 222c460d45ac120ae45940628c501d6cfb50f84b /libc/bionic/debug_mapinfo.cpp | |
parent | afb89c2a01089bb247456634a15a58f111bb55a6 (diff) | |
download | bionic-72bbd423579bb971dc06cdd3c06201faf3fe95e6.zip bionic-72bbd423579bb971dc06cdd3c06201faf3fe95e6.tar.gz bionic-72bbd423579bb971dc06cdd3c06201faf3fe95e6.tar.bz2 |
Support for jemalloc to replace dlmalloc.
To use jemalloc, add MALLOC_IMPL = jemalloc in a board config file
and you get the new version automatically.
Update the pthread_create_key tests since jemalloc uses a few keys.
Add a new test to verify memalign works as expected.
Bug: 981363
Change-Id: I16eb152b291a95bd2499e90492fc6b4bd7053836
Diffstat (limited to 'libc/bionic/debug_mapinfo.cpp')
-rw-r--r-- | libc/bionic/debug_mapinfo.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/libc/bionic/debug_mapinfo.cpp b/libc/bionic/debug_mapinfo.cpp index c5b9aa7..e81ea54 100644 --- a/libc/bionic/debug_mapinfo.cpp +++ b/libc/bionic/debug_mapinfo.cpp @@ -30,7 +30,13 @@ #include <string.h> #include <stdlib.h> +#ifdef USE_JEMALLOC +#include "jemalloc.h" +#define Malloc(function) je_ ## function +#else #include "dlmalloc.h" +#define Malloc(function) dl ## function +#endif #include "debug_mapinfo.h" // 6f000000-6f01e000 rwxp 00000000 00:0c 16389419 /system/lib/libcomposer.so @@ -46,7 +52,7 @@ static mapinfo_t* parse_maps_line(char* line) { if (len < 50) return 0; if (line[20] != 'x') return 0; - mapinfo_t* mi = static_cast<mapinfo_t*>(dlmalloc(sizeof(mapinfo_t) + (len - 47))); + mapinfo_t* mi = static_cast<mapinfo_t*>(Malloc(malloc)(sizeof(mapinfo_t) + (len - 47))); if (mi == 0) return 0; mi->start = strtoul(line, 0, 16); @@ -79,7 +85,7 @@ __LIBC_HIDDEN__ void mapinfo_destroy(mapinfo_t* mi) { while (mi != NULL) { mapinfo_t* del = mi; mi = mi->next; - dlfree(del); + Malloc(free)(del); } } |