2 Replies Latest reply on Sep 6, 2012 3:13 PM by peterj

    Interesting JBoss 5 Memory Footprint/Leak

    hangsu

      Hi All,

       

      I am having a rather interesting memory leak problem with JBoss5 recently.

       

      So the heap size is 4G, and from profiling tool, JVM think it's managing 4G of memory.

      I did couple memory dumps at different stage, it's also less than 4G.

       

      Now the interesting thing is, if I check the memory in Linux, the JBoss JVM process is taking 97%+ RAM and increasing until OOM Killer jump in and kill the process. (We are on a VM with 8G RAM)

       

      What make it more interesting is, we have -XX:AggressiveHeap in JAVA_OPTS, once I took that out and restart JBoss, everything is back to normal.

       

       

      This make me believe it's some glitch in Java GC, that the Linux OS is unable to free RAM JVM trying to release. But I can't find anything related to this on google.

       

      I can provide more information if needed. Some basic environment are:

       

      OS: CentOS5 64bit

      JAVA: Oracle JDK 1.6.0_31 64 bit

       

      And just in case you wonder, why I post it here rather than JAVA forum, we have same product in JBoss4 and it was running fine, and I believe the migration code change is done correctly, and same product for another customer is running fine in JBoss5. I could compare the difference between the two versions, but as you can see from heap size, this is a monster product and code base are very different from release to release.

       

      Has anyone see anything similar to this? any help or information would be appreciated.

        • 1. Re: Interesting JBoss 5 Memory Footprint/Leak
          wdfink

          GC is always very difficult to analyze

           

          What you might do is check the heap utilization from startup in intervalls, I use "jstat -gc ...." for this as it has a minimal footprint.

          Check whether there is a constant increase of used memory.

          Is the load different over the time? Do you run the same application and load on AS4?

           

          The memory consumption is (young+survivor+old) aka heap, and additional PermGen, ThreadStack and JVM code. So it looks possible that threads or JVM consume memory.

          Other problems might be the JVM version and OS patches (I've seen issues that a OS patch fix such, but at a non Linux OS).

          You might start here and check the differences.

          What if you remove the AggressiveHeap option?

          • 2. Re: Interesting JBoss 5 Memory Footprint/Leak
            peterj

            The -XX:AggressiveHeap option is used by Oracle mainly to run various benchmarks. This option sets numerous other options to specific values, and those values are tuned to get the benchmarks to run optimally. In real life, this option rearely provides any benefit, I always recommend that people avoid it.

             

            Also, be careful when looking at java process memory usage via the OS - there is a lot more to java process memory usage than just the heap! It sounds as if the app server is creating way to many threads and they are eating up the memory - try monitoring the thread count. (Note that the memory used for the heap will NEVER exceed the -Xmx value!)