fdtrack: GC before checking fd count.

Test: treehugger
Change-Id: I0f1d59ae4240a24f8b8e4b015c1923acb1140bce
This commit is contained in:
Josh Gao
2020-09-11 15:31:31 -07:00
parent 3ede7b4930
commit 192102c35b

View File

@@ -439,6 +439,12 @@ public final class SystemServer {
boolean enabled = false;
while (true) {
int maxFd = getMaxFd();
if (maxFd > enableThreshold) {
// Do a manual GC to clean up fds that are hanging around as garbage.
System.gc();
maxFd = getMaxFd();
}
if (maxFd > enableThreshold && !enabled) {
Slog.i("System", "fdtrack enable threshold reached, enabling");
System.loadLibrary("fdtrack");