From 9eaa3ef462b338fa2426930e2d3072b43291abcf Mon Sep 17 00:00:00 2001 From: Evgeniy Stepanov Date: Tue, 29 Nov 2016 00:22:50 +0000 Subject: Return memory to OS right after free (not in the async thread). Summary: In order to avoid starting a separate thread to return unused memory to the system (the thread interferes with process startup on Android, Zygota waits for all threads to exit before fork, but this thread never exits), try to return it right after free. Reviewers: eugenis Subscribers: cryptoad, filcab, danalbert, kubabrecka, llvm-commits Patch by Aleksey Shlyapnikov. Differential Revision: https://reviews.llvm.org/D27003 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@288091 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/sanitizer_common/sanitizer_common.h | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'lib/sanitizer_common/sanitizer_common.h') diff --git a/lib/sanitizer_common/sanitizer_common.h b/lib/sanitizer_common/sanitizer_common.h index 5073e0d1b..70b10864c 100644 --- a/lib/sanitizer_common/sanitizer_common.h +++ b/lib/sanitizer_common/sanitizer_common.h @@ -375,12 +375,6 @@ void SetCheckFailedCallback(CheckFailedCallbackType callback); // The callback should be registered once at the tool init time. void SetSoftRssLimitExceededCallback(void (*Callback)(bool exceeded)); -// Callback to be called when we want to try releasing unused allocator memory -// back to the OS. -typedef void (*AllocatorReleaseToOSCallback)(); -// The callback should be registered once at the tool init time. -void SetAllocatorReleaseToOSCallback(AllocatorReleaseToOSCallback Callback); - // Functions related to signal handling. typedef void (*SignalHandlerType)(int, void *, void *); bool IsHandledDeadlySignal(int signum); @@ -843,6 +837,10 @@ struct StackDepotStats { uptr allocated; }; +// The default value for allocator_release_to_os_interval_ms common flag to +// indicate that sanitizer allocator should not attempt to release memory to OS. +const s32 kReleaseToOSIntervalNever = -1; + } // namespace __sanitizer inline void *operator new(__sanitizer::operator_new_size_type size, -- cgit v1.2.3