The cause of the PermGen OutOfMemory error is the app redeploys. The underlying cause is leaked Class objects in PermGen from the redeploys.
Of course, the workaround is to restart the JVM after a certain number of redeploys.
This is a very difficult problem to totally solve, although with some sleuthing you can often make big improvements. Here's where you start: When your web app is stopped, make sure that:
- all Threads that you started are stopped
- all ThreadPools that you started are shut down
- all static references that you can release are released
These are some of the things that can cause a Class object to be trapped in PermGen.
Also, note that not all JVMs (or all versions of JVMs) will GC Class objects in PermGen. If you are running a JVM or a version of a JVM that will not GC Class objects in PermGen, then your only choice is to restart the JVM after a certain number of redeploys. This probably does not apply to you, given the JVM options you mention.