Query total memory just once.

Closes #8315
This commit is contained in:
Alan Evans 2019-06-14 15:34:10 -04:00 committed by Greyson Parrelli
parent 6fceb25121
commit b8bb2b78bd

View File

@ -466,11 +466,11 @@ public class SubmitLogFragment extends Fragment {
}
public static String getMemoryUsage(Context context) {
Runtime info = Runtime.getRuntime();
info.totalMemory();
Runtime info = Runtime.getRuntime();
long totalMemory = info.totalMemory();
return String.format(Locale.ENGLISH, "%dM (%.2f%% free, %dM max)",
asMegs(info.totalMemory()),
(float)info.freeMemory() / info.totalMemory() * 100f,
asMegs(totalMemory),
(float)info.freeMemory() / totalMemory * 100f,
asMegs(info.maxMemory()));
}