[asan] Use linker initialization for the allocator 47/182747/2
authorKuba Mracek <mracek@apple.com>
Fri, 22 Jun 2018 12:56:46 +0000 (15:56 +0300)
committerDongkyun Son <dongkyun.s@samsung.com>
Thu, 19 Jul 2018 09:11:04 +0000 (09:11 +0000)
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

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@320660 91177308-0d34-0410-b5e6-96231b3b80d8

Change-Id: I409b9dc7f73e13248987dd38d96a074ffc2ff044

libsanitizer/asan/asan_allocator.cc

index 1f15235..7bb766d 100644 (file)
@@ -263,9 +263,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);
   }
 
@@ -741,7 +741,7 @@ StackTrace AsanChunkView::GetFreeStack() {
 }
 
 void InitializeAllocator(const AllocatorOptions &options) {
-  instance.Initialize(options);
+  instance.InitLinkerInitialized(options);
 }
 
 void ReInitializeAllocator(const AllocatorOptions &options) {