Java Memory Used memoryUsedInMB()

Here you can find the source of memoryUsedInMB()

Description

Returns the amount of memory currently used by the JVM, in megabytes.

License

Open Source License

Declaration

public static long memoryUsedInMB() 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static final long MEGA = 1048576;

    /**/*from  w w  w.ja  va2 s  .  c  o m*/
     * Returns the amount of memory currently used by the JVM, in megabytes.
     * @return
     */
    public static long memoryUsedInMB() {
        return (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) / MEGA;
    }
}

Related

  1. makeUsedPhysicalMemoryData(long systemPhysicalMaxValue, long systemPhysicalFreeValue)
  2. measureMemoryUse()
  3. memoryUsed()
  4. memoryUsed()
  5. memoryUsed()
  6. stringMemoryUsedInMB()
  7. usedMemory()
  8. usedMemory()
  9. usedMemory()