Showing posts with label JVM. Show all posts
Showing posts with label JVM. Show all posts

Tuesday, 19 August 2014

Checking the JVM Heap Allocation Quickly from the Command Line

One liner for checking the JVM heap memory allocation:

java -server -XX:+UnlockDiagnosticVMOptions -XX:+PrintFlagsFinal -version | grep -i heapsize

On a 32 bit JVM:

uintx ErgoHeapSizeLimit                    = 0                {product}
uintx InitialHeapSize                     := 63763392         {product}
uintx LargePageHeapSizeThreshold           = 134217728        {product}
uintx MaxHeapSize                         := 1020214272       {product}
java version "1.6.0_22"
Java(TM) SE Runtime Environment (build 1.6.0_22-b04)
Java HotSpot(TM) Server VM (build 17.1-b03, mixed mode)

(1 gigabyte allocated)

On a 64 bit JVM:

uintx ErgoHeapSizeLimit                    = 0                {product}
uintx InitialHeapSize                     := 128755328        {product}
uintx LargePageHeapSizeThreshold           = 134217728        {product}
uintx MaxHeapSize                         := 2060085248       {product}
java version "1.6.0_22"
Java(TM) SE Runtime Environment (build 1.6.0_22-b04)
Java HotSpot(TM) 64-Bit Server VM (build 17.1-b03, mixed mode)

(2 gigabytes allocated)

A 32 bit JVM is allocated 1G and a 64 bit JVM is allocated 2G to the max heap space by default.