Getting the Size of the Java Memory Heap : Runtime « Development Class « Java
- Java
- Development Class
- Runtime
Getting the Size of the Java Memory Heap
public class Main {
public static void main(String[] argv) throws Exception {
long heapSize = Runtime.getRuntime().totalMemory();
long heapMaxSize = Runtime.getRuntime().maxMemory();
long heapFreeSize = Runtime.getRuntime().freeMemory();
}
}
Related examples in the same category