Question

I've got an app which is running on JBoss. The server's RAM is too low (about 2gb), so I need to decrease Java heap size. Also I've got 2 versions of Java : system version(1.4.2) and 1.7.0 for JBoss 7 only. So, how can I decrease Java heap size properly?

Was it helpful?

Solution 2

You can change the heap size in jboss startup file, edit bat or sh file and search for -Xms and change it to your required size.

OTHER TIPS

There are two flags to control the heap size: -Xms128m will start your heap at 128 megs, and -Xmx1g controls the maximum size (here, it would set it to 1 gig).

Default size of Heap space in Java is 128MB on most of 32 bit Sun's JVM and default values of heap size parameters on 64-bit systems have been increased up by approximately 30%.

You can use

java -XX:+PrintFlagsFinal -version | grep HeapSize

to check your default size.

Read more

You can change size of heap space by using JVM options -Xms and -Xmx. Xms denotes starting size of Heap while -Xmx denotes maximum size of Heap in Java.
You can use java -Xms1024M -Xmx2048M YourApp

Or edit the /bin/run.sh|exe file by searching for “Sun JVM memory allocation pool parameters” and changing the JAVA_OPTS line:

set JAVA_OPTS=%JAVA_OPTS% -server -Xms1152m -Xmx1152m -XX:MaxPermSize=128m -XX:MaxNewSize=128m

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top