[compiler-rt] r320660 - [asan] Use linker initialization for the allocator

Kuba Mracek via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 13 16:07:15 PST 2017


Author: kuba.brecka
Date: Wed Dec 13 16:07:15 2017
New Revision: 320660

URL: http://llvm.org/viewvc/llvm-project?rev=320660&view=rev
Log:
[asan] Use linker initialization for the allocator

This saves ~2 MB of dirty memory footprint. Can be a big deal on mobile devices especially when running multiple processes with ASan.

Differential Revision: https://reviews.llvm.org/D40627


Modified:
    compiler-rt/trunk/lib/asan/asan_allocator.cc

Modified: compiler-rt/trunk/lib/asan/asan_allocator.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_allocator.cc?rev=320660&r1=320659&r2=320660&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_allocator.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_allocator.cc Wed Dec 13 16:07:15 2017
@@ -274,9 +274,9 @@ struct Allocator {
     atomic_store(&max_redzone, options.max_redzone, memory_order_release);
   }
 
-  void Initialize(const AllocatorOptions &options) {
+  void InitLinkerInitialized(const AllocatorOptions &options) {
     SetAllocatorMayReturnNull(options.may_return_null);
-    allocator.Init(options.release_to_os_interval_ms);
+    allocator.InitLinkerInitialized(options.release_to_os_interval_ms);
     SharedInitCode(options);
   }
 
@@ -817,7 +817,7 @@ StackTrace AsanChunkView::GetFreeStack()
 }
 
 void InitializeAllocator(const AllocatorOptions &options) {
-  instance.Initialize(options);
+  instance.InitLinkerInitialized(options);
 }
 
 void ReInitializeAllocator(const AllocatorOptions &options) {




More information about the llvm-commits mailing list