[PATCH] D40666: [sanitizer] Use MADV_FREE on Darwin/BSD to release pages to the OS

Phabricator via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 13 16:05:15 PST 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL320659: [sanitizer] Use MADV_FREE on Darwin/BSD to release pages to the OS (authored by kuba.brecka, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D40666?vs=125030&id=126862#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D40666

Files:
  compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform.h
  compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix_libcdep.cc


Index: compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform.h
===================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform.h
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform.h
@@ -282,5 +282,10 @@
 # define SANITIZER_SUPPRESS_LEAK_ON_PTHREAD_EXIT 0
 #endif
 
+#if SANITIZER_FREEBSD || SANITIZER_MAC || SANITIZER_NETBSD
+# define SANITIZER_MADVISE_DONTNEED MADV_FREE
+#else
+# define SANITIZER_MADVISE_DONTNEED MADV_DONTNEED
+#endif
 
 #endif // SANITIZER_PLATFORM_H
Index: compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix_libcdep.cc
===================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix_libcdep.cc
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix_libcdep.cc
@@ -62,7 +62,8 @@
   uptr beg_aligned = RoundUpTo(beg, page_size);
   uptr end_aligned = RoundDownTo(end, page_size);
   if (beg_aligned < end_aligned)
-    madvise((void*)beg_aligned, end_aligned - beg_aligned, MADV_DONTNEED);
+    madvise((void *)beg_aligned, end_aligned - beg_aligned,
+            SANITIZER_MADVISE_DONTNEED);
 }
 
 void NoHugePagesInRegion(uptr addr, uptr size) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D40666.126862.patch
Type: text/x-patch
Size: 1220 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171214/9e79c365/attachment.bin>


More information about the llvm-commits mailing list