Site icon Narayana Tutorial

How to check Java Heap Memory in windows system

Find Minimum Heap Memory

Open windows command prompt and then enter the following command.

javaw -XX:+PrintFlagsFinal | find “InitialHeapSize”

Ouput


C:\Users\swamy>javaw -XX:+PrintFlagsFinal | find "InitialHeapSize"
    uintx InitialHeapSize                          := 100663296                           {product}

Find Maximum Heap Memory

Open windows command prompt and then enter the following command.

javaw -XX:+PrintFlagsFinal | find “MaxHeapSize”

Output


C:\Users\swamy>javaw -XX:+PrintFlagsFinal | find "MaxHeapSize"
    uintx MaxHeapSize                              := 1606418432                          {product}

Find ThreadStackSize , HeapSizePerGCThread Memory

Open windows command prompt and then enter the following command.

C:\Users\swamy>java -XX:+PrintFlagsFinal -version | findstr /i "HeapSize PermSize ThreadStackSize"
     intx CompilerThreadStackSize                   = 0                                   {pd product}
    uintx ErgoHeapSizeLimit                         = 0                                   {product}
    uintx HeapSizePerGCThread                       = 87241520                            {product}
    uintx InitialHeapSize                          := 100663296                           {product}
    uintx LargePageHeapSizeThreshold                = 134217728                           {product}
    uintx MaxHeapSize                              := 1606418432                          {product}
     intx ThreadStackSize                           = 0                                   {pd product}
     intx VMThreadStackSize                         = 0                                   {pd product}
java version "1.8.0_211"
Java(TM) SE Runtime Environment (build 1.8.0_211-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.211-b12, mixed mode)

JVM parameters for optimum memory and garbage collection (GC).

-server

-Xms24576M

-Xmx24576M

-XX:NewSize=6144M

-XX:MaxNewSize=6144M

-XX:PermSize=256M

-XX:MaxPermSize=256M

-XX:ThreadStackSize=300

-XX:MaxTenuringThreshold=0

-XX:SurvivorRatio=128

-XX:+UseTLAB

-verbose:gc

-Dsun.rmi.dgc.client.gcInterval=600000 

-Xloggc:<location of the GC logs>

-XX:-UsePerfData

-XX:+PrintVMOptions 

-XX:+TraceClassUnloading 

-XX:+DisableExplicitGC

-XX:+CMSParallelRemarkEnabled 

-XX:+PrintGCDetails

-XX:+PrintGCTimeStamps

-XX:+UseParNewGC

-XX:+UseConcMarkSweepGC 

-XX:ParallelGCThreads=<number of cpus>

-XX:CMSMarkStackSize=8M

-XX:CMSMarkStackSizeMax=32M

-XX:+UseCMSCompactAtFullCollection

-XX:CMSFullGCsBeforeCompaction=0

-XX:+ParallelRefProcEnabled

-XX:+CMSClassUnloadingEnabled

-XX:+CMSPermGenSweepingEnabled

-XX:+CMSIncrementalMode

-XX:+CMSIncrementalPacing

-XX:CMSIncrementalDutyCycleMin=0

-XX:CMSIncrementalDutyCycle=10

-XX:+UseCMSInitiatingOccupancyOnly