summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Christopher Ferris <cferris@google.com> 2023-03-21 18:14:22 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2023-03-21 18:14:22 +0000
commit2325b1da98f872ee1746e4a4f087d832b7cbebaf (patch)
tree253ac167f023319050cd9b5939a8338635dd53f8
parent32060bfc876fe5c505e9cfbd1479820bc104b4c6 (diff)
parent571aa6fb494621acb178c42a7a70f64e7c6f6e7d (diff)
Merge "Switch to purge all unused memory to kernel."
-rw-r--r--core/jni/com_android_internal_os_Zygote.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/core/jni/com_android_internal_os_Zygote.cpp b/core/jni/com_android_internal_os_Zygote.cpp
index 57a196fa3d0c..a5d979ceade6 100644
--- a/core/jni/com_android_internal_os_Zygote.cpp
+++ b/core/jni/com_android_internal_os_Zygote.cpp
@@ -2296,7 +2296,9 @@ pid_t zygote::ForkCommon(JNIEnv* env, bool is_system_server,
// region shared with the child process we reduce the number of pages that
// transition to the private-dirty state when malloc adjusts the meta-data
// on each of the pages it is managing after the fork.
- mallopt(M_PURGE, 0);
+ if (mallopt(M_PURGE_ALL, 0) != 1) {
+ mallopt(M_PURGE, 0);
+ }
}
pid_t pid = fork();