[PATCH] D39318: [Sanitizers] Set default allocator_release_to_os_interval_ms to 5 seconds
Aleksey Shlyapnikov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 26 10:59:46 PDT 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL316683: [Sanitizers] Set default allocator_release_to_os_interval_ms to 5 seconds (authored by alekseyshl).
Repository:
rL LLVM
https://reviews.llvm.org/D39318
Files:
compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator_primary64.h
compiler-rt/trunk/lib/sanitizer_common/sanitizer_flags.inc
Index: compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator_primary64.h
===================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator_primary64.h
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator_primary64.h
@@ -669,10 +669,16 @@
// Map more space for chunks, if necessary.
if (new_space_end > region->mapped_user) {
- if (!kUsingConstantSpaceBeg && kRandomShuffleChunks)
- if (UNLIKELY(region->mapped_user == 0))
+ if (UNLIKELY(region->mapped_user == 0)) {
+ if (!kUsingConstantSpaceBeg && kRandomShuffleChunks)
// The random state is initialized from ASLR.
region->rand_state = static_cast<u32>(region_beg >> 12);
+ // Postpone the first release to OS attempt for ReleaseToOSIntervalMs,
+ // preventing just allocated memory from being released sooner than
+ // necessary and also preventing extraneous ReleaseMemoryPagesToOS calls
+ // for short lived processes.
+ region->rtoi.last_release_at_ns = NanoTime();
+ }
// Do the mmap for the user memory.
uptr map_size = kUserMapSize;
while (new_space_end > region->mapped_user + map_size)
Index: compiler-rt/trunk/lib/sanitizer_common/sanitizer_flags.inc
===================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_flags.inc
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_flags.inc
@@ -129,11 +129,11 @@
" This limit does not affect memory allocations other than"
" malloc/new.")
COMMON_FLAG(bool, heap_profile, false, "Experimental heap profiler, asan-only")
-COMMON_FLAG(s32, allocator_release_to_os_interval_ms, kReleaseToOSIntervalNever,
- "Experimental. Only affects a 64-bit allocator. If set, tries to "
- "release unused memory to the OS, but not more often than this "
- "interval (in milliseconds). Negative values mean do not attempt "
- "to release memory to the OS.\n")
+COMMON_FLAG(s32, allocator_release_to_os_interval_ms, 5000,
+ "Only affects a 64-bit allocator. If set, tries to release unused "
+ "memory to the OS, but not more often than this interval (in "
+ "milliseconds). Negative values mean do not attempt to release "
+ "memory to the OS.\n")
COMMON_FLAG(bool, can_use_proc_maps_statm, true,
"If false, do not attempt to read /proc/maps/statm."
" Mostly useful for testing sanitizers.")
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D39318.120454.patch
Type: text/x-patch
Size: 2581 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171026/5aec12a7/attachment.bin>
More information about the llvm-commits
mailing list