Java Memory Usage getMemoryUsage()

Here you can find the source of getMemoryUsage()

Description

Gets memory usage, in MB

License

Open Source License

Declaration

public static long getMemoryUsage() 

Method Source Code

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

public class Main {
    /**/*from   w w w. j  a  va  2  s  .c o  m*/
     * Gets memory usage, in MB
     * @return
     */
    public static long getMemoryUsage() {
        long memory = Runtime.getRuntime().totalMemory();

        return Math.round(memory / Math.pow(2, 20));
    }
}

Related

  1. getMemoryUsage()
  2. getMemoryUsage()
  3. getMemoryUsage()
  4. getMemoryUsage()
  5. getMemoryUsage()
  6. getMemoryUsage()
  7. getMemoryUsage()
  8. getMemoryUsageSimpleHr()
  9. getMemoryUsageUnix()