diff options
author | Kostya Serebryany <kcc@google.com> | 2013-10-18 15:07:07 +0000 |
---|---|---|
committer | Kostya Serebryany <kcc@google.com> | 2013-10-18 15:07:07 +0000 |
commit | 1fe68b87dcd9be36b5b4d35e74cc5b0666500ec4 (patch) | |
tree | 4c211f893ba7a19f05a7e610eb3cca565cfb2196 /lib/asan/asan_thread.cc | |
parent | 6d95869fa900da9ddd68e15e2aa065854cfa176b (diff) |
[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
Diffstat (limited to 'lib/asan/asan_thread.cc')
-rw-r--r-- | lib/asan/asan_thread.cc | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/asan/asan_thread.cc b/lib/asan/asan_thread.cc index a52ab5a0a..00d62c0e7 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); } |