How to increase heap memory for WildFly?

Linux:

bin/standalone.conf

Check for the following line,

JAVA_OPTS

and change it accordingly to suit your heap size needs

-Xms1303m: initial heap size in megabytes
-Xmx1303m: maximum heap size in megabytes

JAVA_OPTS="-Xms1024M -Xmx2048M -XX:MaxPermSize=2048M -XX:MaxHeapSize=2048M"

Windows:

bin/standalone.conf.bat

JAVA_OPTS="-Xms1024M -Xmx2048M -XX:MaxPermSize=2048M -XX:MaxHeapSize=2048M"

Now restart the server and it will work without prompting any heap size errors.


if wildfly 8 is used along with JDK 8, We need to add MaxMetaSpace Size. For example, JAVA_OPTS="$JAVA_OPTS -XX:MaxMetaspaceSize=256M" As we all know Java 8 does not support Perm gen setting. For related information, Please check Wildfly Heap issue

I hope it helps.


On OS WINDOWS you need to setting standalone.conf.bat


Just edit bin/standalone.conf, look for the first occurrence of JAVA_OPTS and change the -Xmx option according to your needs.