Perm gen is short for permanent generation. Perm gen is memory that is allocated for certain tasks, such as keeping a declaration of the classes being used by the Java application.
The -XX:MaxPermSize option in the tomcat_home/profiles/your_jvm_name/setenv.sh. file contains the maximum perm gen size for a JVM. In this example, a maximum of 256 MB of memory can be used by perm gen.
If you change the perm gen size, you will need to restart the JVM for the change to take effect.
Out of Memory
If the JVM requires more perm gen memory than has been allocated, an out of memory event will appear in the catalina.out log.
java.lang.OutOfMemoryError: PermGen space
After an out of memory perm gen event, there will usually be a heap dump in the catalina.out log.
Dumping heap to /path/to/java_pid12345.hprof ...
Check the catalina.log to determine the recent dates and times that the WAR was deployed.
Apr 04, 2018 8:00:42 PM org.apache.catalina.startup.HostConfig deployWAR INFO: Deploying web application archive tomcat_home/profiles/your_jvm_name/webapps/example.war
If the WAR was deployed two or more times in a short period of time, this can cause an out of memory perm gen space event. In this situation, it may not make sense to increase the maximum perm gen size. Instead, you would want to identify why there were two or more deploys in a short period of time. The catalina.log file will record each deploy.
On the other hand, if there was a single deploy of the WAR and then an out of memory perm gen space event, this usually suggests that the maximum perm gen size should be increased. In this situation, the WAR being deployed may have a number of large files which will require more memory to be able to handle the deploy of the WAR.
When checking the catalina.log file for deploys, be aware that when a JVM is restarted, this will include a deploy event.
You definitely want to do what you can to prevent an out of memory situation from occurring, as the JVM will usually need to be restarted when there is an out of memory event.