List of utility methods to do Memory Used
int | getUsedMemory() Returns the current amount of memory (in MB) this JVM is using. return getAllocatedMemory() - getFreeMemory();
|
long | getUsedMemory() get Used Memory Runtime rt = Runtime.getRuntime(); long usedMB = (rt.totalMemory() - rt.freeMemory()) / 1024 / 1024; return usedMB; |
long | getUsedMemory() get Used Memory Runtime runtime = Runtime.getRuntime();
return runtime.totalMemory() - runtime.freeMemory();
|
long | getUsedMemory() get Used Memory final Runtime runtime = Runtime.getRuntime(); final long freeBytes = runtime.freeMemory(); final long totalBytes = runtime.totalMemory(); return totalBytes - freeBytes; |
long | getUsedMemory() get Used Memory return (getMaxMemory() - getFreeMemory());
|
int | getUsedMemory() get Used Memory return (int) (Runtime.getRuntime().totalMemory() / 1024); |
String | getUsedMemory() Returns a string which describes the amount of memory currently used by the JVM heap. final Runtime runtime = Runtime.getRuntime(); return "Used memory: " + String.valueOf((runtime.totalMemory() - runtime.freeMemory()) / MEGA) + " MB"; |
double | getUsedMemory() Gets the memory used by the JVM in MB. Runtime rt = Runtime.getRuntime(); long memLong = rt.totalMemory() - rt.freeMemory(); double memDouble = memLong / (1024.0 * 1024.0); memDouble = Math.round(memDouble * 100) / 100.0; return memDouble; |
long | getUsedMemory() get Used Memory return Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory();
|
long | getUsedMemory() Return the number of memory bytes used, which is computed by subtracting the 'free' memory from 'total' memory. long total = Runtime.getRuntime().totalMemory(); long free = Runtime.getRuntime().freeMemory(); return total - free; |