9 Replies Latest reply on Oct 30, 2002 5:42 PM by John Shi

    Memory leak with lots of beans

    Adrian Brock Master

      Q: I'm getting out of memory problems when I create
      a lot of beans, how can I solve the memory leak?

      A: This problem is fixed in version 2.4.4.

        • 1. Re: Memory leak with lots of beans
          neil mcclements Newbie


          I've been having problems with lots of bean (instances) & 2.4.4 - see http://main.jboss.org/thread.jsp?forum=61&thread=7750 .

          Any thoughts on tracking down my problem?

          • 2. Re: Memory leak with lots of beans

            I am using JBoss 3.0.0 Final and JBoss 3.0.1RC1 and I am running out of memory after creating about 1450 beans from a client for loop.

            Is this a known problem? Is there a fix?


            • 3. Re: Memory leak with lots of beans
              Mika Kossmann Newbie

              I had the same problem. But the "out of memory" wasn't RAM it was disk space!
              Caused by the very high <max-capacity>1000000</max-capacity> for the bean cache size in the standardjboss.xml
              This seems to be immoderate high? I set it to 10000 for all types of beans and everything was fine. I can't see any advantages in such a high bean cache. As far as I know BEA recommends a max size of 20000 for their server.

              • 4. Re: Memory leak with lots of beans
                Cedric Newbie


                "javaxtc" wrote:
                by the way, how do i check for "memory leak", as my jboss is slowing down and not giving any response after creating quite a huge number of business objects or beans for the client-side app.

                appreciate for any help.

                • 5. Re: Memory leak with lots of beans
                  John Shi Newbie

                  Actually, we are using JBoss 2.4.4. The memory leak problem still exists. We are doing stress test on our product to constantly create and remove entity beans. JProbe is used to monitor the memory usage.

                  We are able to observe the memory usage gradually increasing. One of the loitering objects is org.jboss.ejb.CacheKey. The number of instances of the CacheKey continue to grow till the JVM runs out of memory.

                  Any suggestions to solve this problem? Even a work around would be highly appreciated.



                  • 6. Re: Memory leak with lots of beans
                    Tobias Frech Apprentice

                    Sorry for suggesting the obvious:

                    The changelog for JBoss 2.4.5 mentions fixes for several leaks. The actual version of the 2.4 series is 2.4.10 at the time of writing (check out the Files section on Sourceforge).

                    Does the problem persist when updating to a more recent version ?

                    • 7. Re: Memory leak with lots of beans
                      John Shi Newbie

                      Thanks for your suggestion. I downloaded the 2.4.10 Beta version and tried it with our product. This version has some improvements that it drops some of the instances created. But my main focus is on the instance count of the CacheKey. It still increases with time when I constantly create and delete entity beans.

                      Are there going to be some further fixes for the memory leak problem? Any suggestions if I can avoid this through jboss configuration or through our code changes?

                      Thanks in advance for any information.


                      • 8. Re: Memory leak with lots of beans
                        Tobias Frech Apprentice


                        Scott informed me that he can run a unit test that creates and removes entities and he does not
                        see the CacheKey grow without bound.
                        If the problem persists and you are sure that it is not a problem in your code then I'd like to ask you to submit a testcase that demonstrates the problem.

                        Submit the testcase to the bug tracker at Sourceforge:

                        You have to log in first, then you will be able to submit a bug report / testcase.


                        • 9. Re: Memory leak with lots of beans
                          John Shi Newbie

                          Hi Tobias,

                          Finally I managed to do a test using JBoss's CD example to reproduce this problem by modifying its way to create records.

                          With the original test example, there is a file called Upload.java which create 10 CD records. Now I modified the code to repeatedly create and delete the records forever. One more thing, the primary key, which is an integer, has to be constantly increased, otherwise, problem won't occur.

                          I'll log this problem into the sourceforge with the sample test cases, one shows problem, one doesn't.

                          Thanks again and hope I can get some solution back from JBoss soon.