Do not include libc_common in malloc debug code.
The inclusion of the static libc_common library in the malloc_debug_XXX.so shared libraries causes constructors to be called twice. This doesn't seem to have caused any issues when setting the libc.debug.malloc property. However, jemalloc crashes because there are two jemalloc implementations, one in the static libc_common library and one in the shared library. Each implementation has created overlapping thread keys that are not the same. The crash comes because one of the jemalloc keys is actually used by the locale setting code. Thus if someone sets the locale, the jemalloc code crashes trying to access the same key. Change-Id: Iaac650a82d69064db148a6333e9403744f68b4a4
This commit is contained in:
@@ -51,17 +51,6 @@
|
||||
#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
|
||||
// =============================================================================
|
||||
@@ -116,7 +105,7 @@ struct MallocDebug {
|
||||
#endif
|
||||
};
|
||||
|
||||
typedef bool (*MallocDebugInit)(HashTable*);
|
||||
typedef bool (*MallocDebugInit)(HashTable*, const MallocDebug*);
|
||||
typedef void (*MallocDebugFini)(int);
|
||||
|
||||
// =============================================================================
|
||||
|
||||
Reference in New Issue
Block a user