2011年5月26日 星期四

Monitor memory usage in Java


Use the code to get information of memory usage at runtime.
Runtime runtime = Runtime.getRuntime();long maxMemory = runtime.maxMemory();long allocatedMemory = runtime.totalMemory();long freeMemory = runtime.freeMemory();

Reference: http://stackoverflow.com/questions/74674/how-to-do-i-check-cpu-and-memory-usage-in-java

沒有留言:

張貼留言