From 1fe68b87dcd9be36b5b4d35e74cc5b0666500ec4 Mon Sep 17 00:00:00 2001 From: Kostya Serebryany Date: Fri, 18 Oct 2013 15:07:07 +0000 Subject: [asan] allocate AsanThreadContext using LowLevelAllocator instead of mmap to save space git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@192980 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/asan/asan_thread.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/asan/asan_thread.cc b/lib/asan/asan_thread.cc index a52ab5a0..00d62c0e 100644 --- a/lib/asan/asan_thread.cc +++ b/lib/asan/asan_thread.cc @@ -43,8 +43,12 @@ void AsanThreadContext::OnFinished() { static ALIGNED(16) char thread_registry_placeholder[sizeof(ThreadRegistry)]; static ThreadRegistry *asan_thread_registry; +static BlockingMutex mu_for_thread_context(LINKER_INITIALIZED); +static LowLevelAllocator allocator_for_thread_context; + static ThreadContextBase *GetAsanThreadContext(u32 tid) { - void *mem = MmapOrDie(sizeof(AsanThreadContext), "AsanThreadContext"); + BlockingMutexLock lock(&mu_for_thread_context); + void *mem = allocator_for_thread_context.Allocate(sizeof(AsanThreadContext)); return new(mem) AsanThreadContext(tid); } -- cgit v1.2.3