The "OutOfMemoryError: PermGen space" Java error will appear after Tomcat has exhausted all of its memory. This is typically caused by using the "Update" or "Reload" function on a webapp too many times. Currently, Tomcat and/or the JVM isn't releasing all of the memory when a webapp is destroyed/recreated. After several reloads Tomcat is out of its allotted memory and will hang or freeze.
It is a common error, many people have encountered this problem before you (I guess that's a sad fact). ;-)
The "OutOfMemoryError: PermGen space" message is normally encountered during development activites where a long-running JVM is asked to load/unload builds (i.e. reload/redeploy WARs under Apache Tomcat). However it can also be encountered in a recently spawned JVM under the "right" set of conditions.
The message is a symptom of an incomplete garbage collection sweep where resources are not properly released upon unload/restart.
- Developers: Restart Tomcat after several updates/reloads
- Developers and Implementers: Allow Tomcat to use more memory. This will not stop the error, just prolong times between tomcat restarts. Follow the 'Java Heap Size' solution instructions.
- Implementers: Tell Tomcat to not leak memory
Start Tomcat with the parameters:
- -Xmx512m -Xms512m -XX:PermSize=256m -XX:MaxPermSize=256m -XX:NewSize=128m
Inside Eclipse IDE:
- Click on Tomcat start up
- Click on Java tab in Tomcat startup
- Use the parameters above.