tsan: instruct malloc() to consume less memory

llvm-svn: 177393
This commit is contained in:
Dmitry Vyukov 2013-03-19 12:24:19 +00:00
parent 2712b064d8
commit 9dd06ad47a
1 changed files with 5 additions and 0 deletions

View File

@ -61,6 +61,7 @@ extern "C" void *__libc_malloc(uptr size);
extern "C" void *__libc_calloc(uptr size, uptr n);
extern "C" void *__libc_realloc(void *ptr, uptr size);
extern "C" void __libc_free(void *ptr);
extern "C" int mallopt(int param, int value);
const int PTHREAD_MUTEX_RECURSIVE = 1;
const int PTHREAD_MUTEX_RECURSIVE_NP = 1;
const int kPthreadAttrSize = 56;
@ -1831,6 +1832,10 @@ void InitializeInterceptors() {
REAL(memcpy) = internal_memcpy;
REAL(memcmp) = internal_memcmp;
// Instruct libc malloc to consume less memory.
mallopt(1, 0); // M_MXFAST
mallopt(-3, 32*1024); // M_MMAP_THRESHOLD
SANITIZER_COMMON_INTERCEPTORS_INIT;
TSAN_INTERCEPT(longjmp);