Java Memory Information getMemoryString()

Here you can find the source of getMemoryString()

Description

Gets a String containing info of available and used memory of this JVM.

License

Open Source License

Return

an info string.

Declaration

public static String getMemoryString() 

Method Source Code

//package com.java2s;

public class Main {
    private static final int FACTOR_MB = 1024 * 1024;

    /**/*from www . j av  a2 s  . c o  m*/
     * Gets a String containing info of available and used memory of this JVM.
     * @return an info string.
     */
    public static String getMemoryString() {
        return "Mem Total in JVM: " + (Runtime.getRuntime().totalMemory() / FACTOR_MB) + " Free in JVM: "
                + (Runtime.getRuntime().freeMemory() / FACTOR_MB) + " Max Limit: "
                + (Runtime.getRuntime().maxMemory() / FACTOR_MB);
    }
}

Related

  1. getMemoryLimitMinSize()
  2. getMemoryStats()
  3. getMemoryStats(int mode)
  4. getMemoryStatus(boolean preRunGarbageCollector)
  5. getMemoryString()
  6. getMemoryUtilizationPercent()
  7. getNowMemoryStatus()
  8. getRuntimeMemoryStats()
  9. getRuntimeMemoryStats()