summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/sanitizer_common/sanitizer_common_libcdep.cc
diff options
context:
space:
mode:
authorEvgeniy Stepanov <eugeni.stepanov@gmail.com>2016-11-29 00:22:50 +0000
committerEvgeniy Stepanov <eugeni.stepanov@gmail.com>2016-11-29 00:22:50 +0000
commitd3305afc757513e9a9db6cd70d5b9631e1806b44 (patch)
treeb2bb9aa74158032f301b0cd7bec3d6bdcd1aa7e6 /compiler-rt/lib/sanitizer_common/sanitizer_common_libcdep.cc
parentb9e53c9056fad09fb5e1a5b61ab4b7acffd8d6ad (diff)
downloadbcm5719-llvm-d3305afc757513e9a9db6cd70d5b9631e1806b44.tar.gz
bcm5719-llvm-d3305afc757513e9a9db6cd70d5b9631e1806b44.zip
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 llvm-svn: 288091
Diffstat (limited to 'compiler-rt/lib/sanitizer_common/sanitizer_common_libcdep.cc')
-rw-r--r--compiler-rt/lib/sanitizer_common/sanitizer_common_libcdep.cc9
1 files changed, 0 insertions, 9 deletions
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_common_libcdep.cc b/compiler-rt/lib/sanitizer_common/sanitizer_common_libcdep.cc
index 288ca9556dc..49ca961f3cb 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_common_libcdep.cc
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_common_libcdep.cc
@@ -70,18 +70,11 @@ void SetSoftRssLimitExceededCallback(void (*Callback)(bool exceeded)) {
SoftRssLimitExceededCallback = Callback;
}
-static AllocatorReleaseToOSCallback ReleseCallback;
-void SetAllocatorReleaseToOSCallback(AllocatorReleaseToOSCallback Callback) {
- CHECK_EQ(ReleseCallback, nullptr);
- ReleseCallback = Callback;
-}
-
#if SANITIZER_LINUX && !SANITIZER_GO
void BackgroundThread(void *arg) {
uptr hard_rss_limit_mb = common_flags()->hard_rss_limit_mb;
uptr soft_rss_limit_mb = common_flags()->soft_rss_limit_mb;
bool heap_profile = common_flags()->heap_profile;
- bool allocator_release_to_os = common_flags()->allocator_release_to_os;
uptr prev_reported_rss = 0;
uptr prev_reported_stack_depot_size = 0;
bool reached_soft_rss_limit = false;
@@ -127,7 +120,6 @@ void BackgroundThread(void *arg) {
SoftRssLimitExceededCallback(false);
}
}
- if (allocator_release_to_os && ReleseCallback) ReleseCallback();
if (heap_profile &&
current_rss_mb > rss_during_last_reported_profile * 1.1) {
Printf("\n\nHEAP PROFILE at RSS %zdMb\n", current_rss_mb);
@@ -162,7 +154,6 @@ void MaybeStartBackgroudThread() {
// Start the background thread if one of the rss limits is given.
if (!common_flags()->hard_rss_limit_mb &&
!common_flags()->soft_rss_limit_mb &&
- !common_flags()->allocator_release_to_os &&
!common_flags()->heap_profile) return;
if (!&real_pthread_create) return; // Can't spawn the thread anyway.
internal_start_thread(BackgroundThread, nullptr);
OpenPOWER on IntegriCloud