Java Memory Allocate getAllocatedMemory()

Here you can find the source of getAllocatedMemory()

Description

Returns the allocated amount of memory (in MB) this JVM is using.

License

Open Source License

Return

allocated memory

Declaration

public static int getAllocatedMemory() 

Method Source Code

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

public class Main {
    /**/*from  ww w .  jav a2s  .  c om*/
     * Returns the allocated amount of memory (in MB) this JVM is using.
     *
     * @return allocated memory
     */
    public static int getAllocatedMemory() {
        return Math.round((float) (Runtime.getRuntime().totalMemory() / 1048576L));
    }
}

Related

  1. allocatedMemory()
  2. allocatedMemory()
  3. getAllocatedMemory()
  4. getAllocatedMemoryMB()
  5. getMemoryAllocated()
  6. memoryAllocated()