javamemorywildflyheap-memorywildfly-11

Wildfly 11 with -Xms8g runs with only 400m


I'm running Wildfly 11 on a VM Windows Machine and jdk 1.8 JAVA_OPTS is set in standalaone.conf.bat with

set "JAVA_OPTS=-Xms8g -Xmx8g -XX:MetaspaceSize=8g -XX:MaxMetaspaceSize=8g"

I'm running standalone.bat in WILDFLY_HOME/bin directory with everything else kept as default.

When I run Task manager, I'm seeing as maximum 400m memory allocated by JVM. Shouldn't it be 8g instead? As the xms param is set to 8g? Anyone knows what to expect to see as memory provisioned by the JVM in the TAsk manager? Thanks.


Solution

  • This is related with JVM. When you set -XMS size and if application used memory less than XMS size , JVM dosen't force to use to memory. For example "Hello world" application with -XMS8g, this application never will use 8gb memory. The JVM reserves the memory specified by Xms at the start but reserved area and used area is different each other. Furthermore, reservation need not be in the physical memory, it can also be in the swap.

    If you want see this area, you can see with Resource Monitor in Windows. Open Memory tab in Resouce Monitor. You will see the two section, Commit and Working Set. You can see the difference here.