From d2e59ebfdaa0a5c9ed5a5324889b25172ce1e97a Mon Sep 17 00:00:00 2001 From: Evgeniy Stepanov Date: Wed, 30 Nov 2016 20:41:59 +0000 Subject: Release memory to OS only when the requested range covers the entire page Summary: The current code was sometimes attempting to release huge chunks of memory due to undesired RoundUp/RoundDown interaction when the requested range is fully contained within one memory page. Reviewers: eugenis Subscribers: kubabrecka, llvm-commits Patch by Aleksey Shlyapnikov. Differential Revision: https://reviews.llvm.org/D27228 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@288271 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/sanitizer_common/sanitizer_common.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (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 70b10864c..bf66d00d6 100644 --- a/lib/sanitizer_common/sanitizer_common.h +++ b/lib/sanitizer_common/sanitizer_common.h @@ -103,7 +103,9 @@ uptr FindAvailableMemoryRange(uptr size, uptr alignment, uptr left_padding); // Used to check if we can map shadow memory to a fixed location. bool MemoryRangeIsAvailable(uptr range_start, uptr range_end); -void ReleaseMemoryToOS(uptr addr, uptr size); +// Releases memory pages entirely within the [beg, end] address range. Noop if +// the provided range does not contain at least one entire page. +void ReleaseMemoryPagesToOS(uptr beg, uptr end); void IncreaseTotalMmap(uptr size); void DecreaseTotalMmap(uptr size); uptr GetRSS(); -- cgit v1.2.3