Java Memory Information printMemoryInfo()

Here you can find the source of printMemoryInfo()

Description

Print memory info

License

Apache License

Declaration

public static void printMemoryInfo() 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    /**/*from w  ww .  j  a  va  2  s  . co  m*/
     * Print memory info
     */
    public static void printMemoryInfo() {
        Runtime currRuntime = Runtime.getRuntime();
        int nFreeMemory = (int) (currRuntime.freeMemory() / 1024 / 1024);
        int nTotalMemory = (int) (currRuntime.totalMemory() / 1024 / 1024);
        String message = nFreeMemory + "M/" + nTotalMemory + "M(free/total)";
        System.out.println("memory:" + message);
    }
}

Related

  1. prettyPrintMemoryPerSecond(long rate)
  2. printMemory()
  3. printMemory()
  4. printMemory(String label)
  5. printMemory(String str)
  6. printMemoryInstruction(byte[] instruction)
  7. showMemory()
  8. showMemoryInfo()