diff options
author | ChiaHungDuan <chiahungduan@google.com> | 2024-04-01 10:09:40 -0700 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2024-04-01 10:15:39 -0700 |
commit | b2e25a8717a93495a3b7345786b24b1402a75479 (patch) | |
tree | 4340bf1c0b4f1fe7e2e47e8fb4d007cc1a7a7b6b | |
parent | 34ad29845209be6d7ec9658fbfcf4e574447b08d (diff) | |
download | scudo-b2e25a8717a93495a3b7345786b24b1402a75479.tar.gz |
[scudo] Do a M_PURGE call before changing release interval on Android (#87110)
GitOrigin-RevId: 92d0d6f6cb4099e651d066cd88dc0abfa6e612cf
Change-Id: I25bb390880cb1389963a3c8fc143ec30550cfb75
-rw-r--r-- | standalone/wrappers_c.inc | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/standalone/wrappers_c.inc b/standalone/wrappers_c.inc index 56d8ef20156..21d5b7add51 100644 --- a/standalone/wrappers_c.inc +++ b/standalone/wrappers_c.inc @@ -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); + if (value == 0) { // Will set the release values to their minimum values. value = INT32_MIN; |