Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Find configured max heap space size on Linux system

A quick way to find the currently configured heap space on your Linux machine is the following command:

java -XX:+PrintFlagsFinal -version | grep HeapSize

It will output everything in byte. Here is how it looks in real life with around 8GB of heap space

hlars@superdev.system >>java -XX:+PrintFlagsFinal -version | grep HeapSize
    uintx ErgoHeapSizeLimit                         = 0                                   {product}
    uintx HeapSizePerGCThread                       = 87241520                            {product}
    uintx InitialHeapSize                          := 526385152                           {product}
    uintx LargePageHeapSizeThreshold                = 134217728                           {product}
    uintx MaxHeapSize                              := 8415870976                          {product}
java version "1.8.0_172"
Java(TM) SE Runtime Environment (build 1.8.0_172-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.172-b11, mixed mode)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.