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
This commit is contained in:
Christopher Ferris
2014-05-08 11:14:03 -07:00
parent afb89c2a01
commit 72bbd42357
13 changed files with 206 additions and 80 deletions

View File

@@ -45,11 +45,22 @@
#define MAX_SIZE_T (~(size_t)0)
// This must match the alignment used by dlmalloc.
// This must match the alignment used by the malloc implementation.
#ifndef MALLOC_ALIGNMENT
#define MALLOC_ALIGNMENT ((size_t)(2 * sizeof(void *)))
#endif
#ifdef USE_JEMALLOC
#include "jemalloc.h"
#define Malloc(function) je_ ## function
#else
#ifndef USE_DLMALLOC
#error "Either one of USE_DLMALLOC or USE_JEMALLOC must be defined."
#endif
#include "dlmalloc.h"
#define Malloc(function) dl ## function
#endif
// =============================================================================
// Structures
// =============================================================================