![]() This file is not included in the tomcat package or installation, and it is manually created under the bin directory in case the administrator needs to tune the default tomcat memory configuration. In order to set the appropriate heap size and perm gen size, tomcat requires a file named as setenv.sh in unix environments and setenv.bat in windows. Summaryīy default, the memory size allocated for tomcat is not enough to handle heavy applications which require high memory usage, several OutOfMemoryError exceptions will be thrown if you keep the default tomcat configuration. ![]() In case of low perm gen space, “OutOfMemoryError: PermGen” exception is thrown. The perm gen size is the space where your code base is stored inside the memory, the bigger your code base is, the more perm gen space is required, normally application wouldn’t require more than maximum 1 GB of Perm gen space. ![]() XX: MaxPermSize: This is the maximum perm gen size. XX:PermSize: This is the initial perm gen size. In case of low heap space, “OutOfMemoryError: java heap space” exception is thrown. The heap is the memory space which holds all the objects created by your application, it is the memory space allocated for your application, normally an application wouldn’t require more than maximum 2 GB of memory. Xmx: This is the maximum java heap size. P.S: If tomcat is installed as a windows service, you can also set the memory configuration through running Tomcat8w.exe under bin folder as the following:Ĭreate a new script named as setenv.sh under TOMCAT_HOME/bin directory holding the following content: export JAVA_OPTS="-Dfile.encoding=UTF-8 -Xms128m -Xmx2048m -XX:PermSize=265m -XX:MaxPermSize=1024m"Īfter creating the script, tomcat needs to be restarted for the changes to take effect. setenv scriptįollowing is the process for creating setenv script in both windows and unix machines:Ĭreate a new script named as setenv.bat under TOMCAT_HOME/bin folder holding the following content: set JAVA_OPTS=-Dfile.encoding=UTF-8 -Xms128m -Xmx2048m -XX:PermSize=265m -XX:MaxPermSize=1024m By default, the memory size allocated for tomcat is not enough to handle heavy applications which require high memory usage, several OutOfMemoryError exceptions will be thrown if you keep the default tomcat configuration. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |