[compiler-rt] [scudo] Do a M_PURGE call before changing release interval on Android (PR #87110)

via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 1 09:32:02 PDT 2024


================
@@ -247,6 +247,11 @@ void SCUDO_PREFIX(malloc_postinit)() {
 INTERFACE WEAK int SCUDO_PREFIX(mallopt)(int param, int value) {
   if (param == M_DECAY_TIME) {
     if (SCUDO_ANDROID) {
+      // Before changing the interval, reset the memory usage status by doing a
+      // M_PURGE call so that we can minimize the impact of any unreleased pages
+      // introduced by interval transition.
+      SCUDO_ALLOCATOR.releaseToOS(scudo::ReleaseToOS::Force);
----------------
ChiaHungDuan wrote:

Based on the use case, They show similar memory footprint reduction but have noticeable latency difference. As a result, I think Force is good enough so far.

https://github.com/llvm/llvm-project/pull/87110


More information about the llvm-commits mailing list