Version 22

    Why Do I Get an OutOfMemoryException after Redeploying My Application Several Times ?

     

    There is a BUG related to class unloading http://jira.jboss.com/jira/browse/JBAS-1319.

     

    The web container (Tomcat) was still holding references to the ClassLoaders (required condition to unload the class).

     

     

    Sun's Java virtual machine creates a so called Permanent Generation in their memory heap where they store reflective data about the current runtime. In practice this usually means instances of java.lang.Class and java.lang.reflect. classes. These classes are only unloaded if all the references to the classLoaders are gone plus there is no more instances of the class. This will happen during Full GC operations.

     

     

    On Sun JVM (1.3.1 and above) you can increase the PermSize by adding -XX:MaxPermSize=64m switch on the command line where the JVM is started. This initializes the JVM heap to have a permanent generation size of 64 megabytes what can minimize this problem on old versions.