Increase Memory in Linux
You can set the minimum and maximum memory heap size with the JVM -Xms and -Xmx parameters, for example, setting the minimum heap size to 128 MB and the maximum heap size to 1024 MB.
Let's first understand what -Xms, -Xmx, -XX:PermSize and -XX:MaxPermSize are,
- -Xmx<size> - Set initial Java heap size.
- -Xmx<size> - Set maximum Java heap size.
- -XX:PermSize - Initial java permanent space size.
- -XX:MaxPermSize - Maximum java permanent space size.
To set the memory, you have a file named "setenv.sh" in your /tomcat/bin directory. If the file doesn’t exist, then you need to create the file within and set the parameters.
- export JAVA_OPTS="-Xms128m –Xmx256m"
As described above, all these settings take place in the setenv.sh. Add the lines of code mentioned below.
- export JAVA_OPTS="-Xms128m -Xmx256m -XX:MaxPermSize=512m"
- JAVA_OPTS="-Xms256M –Xmx1024M"
Increase Memory in Windows (Started Manually)
To set the memory, you have a file named "setenv.bat" in your /tomcat/bin directory. If the file doesn’t exist, then you need to create the file within and set the parameters.
- set JAVA_OPTS="-Xms128m –Xmx256m"
As described above, all these settings take place in the setenv.bat. Add the code mentioned below.
- set JAVA_OPTS="-Xms128m -Xmx256m -XX:MaxPermSize=512m"
- JAVA_OPTS="-Xms256M –Xmx1024M"