Log free heap memory

This commit is contained in:
M66B
2019-05-16 19:52:46 +02:00
parent 36c691eb25
commit df5376a860
3 changed files with 17 additions and 9 deletions

View File

@@ -614,4 +614,15 @@ public class Helper {
bundle.writeToParcel(p, 0);
return p.dataSize();
}
static long getFreeMem() {
Runtime rt = Runtime.getRuntime();
long used = (rt.totalMemory() - rt.freeMemory());
long max = rt.maxMemory();
return (max - used);
}
static int getFreeMemMb() {
return (int) (getFreeMem() / 1024L / 1024L);
}
}