summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Boehm <hboehm@google.com>2021-07-08 17:21:20 -0700
committerHans Boehm <hboehm@google.com>2021-07-09 17:25:19 +0000
commitf31227558189f103f8d70a5bf9673ec0368c951b (patch)
treea4dc88edbd86632d9833d981f98cbf064c274942
parentf90282c17e2e47288f4875eade4b96743b22a04e (diff)
downloadbase-f31227558189f103f8d70a5bf9673ec0368c951b.tar.gz
Add System.runFinalization() call
Lone calls to System.gc() generally don't do anything. Runtime.getRuntime().gc() would force a GC, but it would be ineffective without waiting for reference processing and finalization to complete. Adding the runFinalization() call implicitly makes the preceding GC call effective. Bug: 183912710 Test: Treehugger Change-Id: I0f4806b8e3f9ca898eb7ea1b1c8de14aa94e2646
-rw-r--r--services/java/com/android/server/SystemServer.java1
1 files changed, 1 insertions, 0 deletions
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java
index 81ec8f42e71a..c08d697d014e 100644
--- a/services/java/com/android/server/SystemServer.java
+++ b/services/java/com/android/server/SystemServer.java
@@ -452,6 +452,7 @@ public final class SystemServer {
if (maxFd > enableThreshold) {
// Do a manual GC to clean up fds that are hanging around as garbage.
System.gc();
+ System.runFinalization();
maxFd = getMaxFd();
}