Runtime: maxMemory() : Runtime « java.lang « Java by API






Runtime: maxMemory()

  

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

1.Runtime: availableProcessors()
2.Runtime: addShutdownHook(Thread hook)
3.Runtime: exec(String[] command)
4.Runtime: exec(String command) (2)
5.Runtime: freeMemory()
6.Runtime: gc()
7.Runtime.getRuntime()
8.Runtime: totalMemory()