Today, during load testing I saw one of those dreaded “java.lang.OutOfMemoryError: PermGen space” errors on our fairly large web application deployed in Tomcat running on Sun JDK 1.5.
We used to use the default (64m) for the perm space. I bumped it to 128 for now, until I can find some time to dig into this using JProfiler and JHAT.
I will be particularly looking at the amount of our classes loaded from WEB-INF/classes dir (we have a lot of generated classes from legacy code), Static references in our legacy code, Spring AOP/Hibernate CGLib usage and ThreadLocal usage in our application.
I found some useful information here: