/** * Class: TestMemory * @author: Viral Patel * @description: Prints JVM memory utilization statistics */ public class TestMemory { public static void main(String [] args) { int mb = 1024 * 1024 ; //Getting the runtime reference from system Runtime runtime = Runtime.getRuntime(); System.out.println( "##### Heap utilization statistics [MB] #####" ); //Print used memory System.out.println( "Used Memory:" + (runtime.totalMemory() - runtime.freeMemory()) / mb); //Print free memory System.out.println( "Free Memory:" + runtime.freeMemory() / mb); //Print total available memory System.out.println( "Total Memory:" + runtime.totalMemory() / mb); //Print Maximum available memory System.out.println( "Max Memory:" + runtime.maxMemory() / mb); |
'COMPUTER > 일반프로그래밍' 카테고리의 다른 글
python 주석 예쁘게 달기.. 참고사이트 (0) | 2013.08.07 |
---|---|
Mybatis (0) | 2013.06.19 |
jdbc, Spring DB연결 관련 note - ktds 수업 노트 (0) | 2013.06.19 |
Serialization, de-serialization (0) | 2013.05.09 |
java garbage collection 관련 글 - 좋은 것 (0) | 2012.08.31 |