How to increase heap memory for WildFly?

WildFly 8 is started on a linux server with standalone.sh. I noticed that the server was started with very few heap memory space.

I need to increase the heap memory space for the server and for applications, which are running on the server. How can I do it?


Solution 1:

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

Solution 2:

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.

Solution 3:

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

Solution 4:

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.