java
자신 메모리 보는 코드
이상욱1
2015. 10. 4. 01:26
package snippet;
public class Snippet {
public static void main (String[] args) {
double[] n1 = new double[1000000];
double[] n2 = new double[1000000];
long free = Runtime.getRuntime().freeMemory();
long total = Runtime.getRuntime().totalMemory();
long max = Runtime.getRuntime().maxMemory();
System.out.format("Total Memory : %6.2f MB%n", (double) total / (1024 * 1024));
System.out.format("Free Memory : %6.2f MB%n", (double) free / (1024 * 1024));
System.out.format("Max Memory : %6.2f MB%n", (double) max / (1024 * 1024));
}
}