1 Reply Latest reply on May 7, 2007 3:58 PM by Pete Muir

    Seam apps leaking memory?!

    stephen.friedrich Novice

      My (not so large) app can be redeployed on JBoss 4.0.5 exactly two times before the deployment is failing.

      I know that the issue of OOME in PermGenSpace has been discussed before and the default answers were either "Sun JVM bug", "use jrockit" (which only increases the available redeploys a little without really solving the problem) or "increase perm space" (dito, I manage up to four redeploys).

      I don't really buy any of thse answers because other apps do not have such severe problems.
      Here's a nice summary:
      http://opensource.atlassian.com/confluence/spring/pages/viewpage.action?pageId=2669

      Using Yourkit I tried to investigate the problem:


      • Started JBoss.
      • Deployed the booking app.
      • Undeployed the booking app.
      • Looked at instances of org.jboss.seam.* classes.


        I have found these two problems:

        • java.beans.Introspector leaks if flushCaches() isn't called. For testing I added such a call in org.jboss.seam.servlet.SeamListener.contextDestroyed()
        • The cache used in javassist's ProxyFactory is never cleared. I updated javassist to version 3.4 and added "ProxyFactory.useCache = false;" to org.jboss.seam.servlet.SeamListener.contextInitialized()
          I doubt that this is the correct way, but it brought down the instance count and did not seem to break anything. (javassist's ProxyFactory is used from org.jboss.seam.Component.createProxyFactory().)


          These changes reduced the instance count but there are still some objects that refuse to get collected. I am stuck: All references to remaining objects come from the UnifiedClassLoader3.
          Looks like "org.jboss.util.timeout.TimeoutFactory$1" is still holding a strong reference to the class loader.

          This is well out of my expertise. I'd really appreciate if somebody could look into that.[/url]