4 Replies Latest reply on Feb 16, 2011 2:47 AM by jpiel

    java.lang.OutOfMemoryError

    raghav.bheem

      hi,
      i am using jboss-4.0.5.GA, apache-ant-1.6.5,Jikes,jdk1.5.0_03,liferay-portal-src-4.2.0. when i access the liferay then after some time i am getting the java.lang.OutOfMemoryError, i configured my jboss by
      -Xms128m -Xmx512m
      then again i getting the same error, i am using 1 gb Ram, and Windows 2000 OS.
      Sometimes my mem usage reach to 960000kb

      Can any body solve my problem ?
      How can i reove this error?

        • 1. Re: java.lang.OutOfMemoryError
          peterj

          You have a memory leak. (Yes, I like stating the obvious!) Google "java memory leak detection tools" for some hints on how to debug this.

          • 2. Re: java.lang.OutOfMemoryError
            raghav.bheem

            hi,
            May be you are right, but these tools can use to where out memory going, but how can i remove that error which i am geting again and again. every time i have to close the server and start it again.
            Should i have to increase my Ram Size?
            IS there s any other method to solve this?

            • 3. Re: java.lang.OutOfMemoryError
              kaobe

              Hi,

              you have to get the information where the leak is located and then fix it. If it is in an external software component that you cannot fix the provider has to fix it. Getting more RAM is not the solution, because it will just last longer until you get the error.
              If you have incredible pain you don't just eat more pills, but you look for the cause and fix it.

              Peter

              • 4. Re: java.lang.OutOfMemoryError
                jpiel

                I face the same problem at work and I use this tool:

                 

                http://www.eclipse.org/mat/

                 

                 

                It gives you a good overview of the heap of your server.

                 

                You can also use the jconsole in the JDK to get an overview of the parts of the heap.

                 

                You also have to consider some issues, if you use individual portlets liferay:

                 

                1. If you use Spring and AnnotationConfigApplicationContext, then you must close the AnnotationConfigApplicationContext.

                2. I make the experience, that SLSB are not destroyed. You must mark a methode with @PreDestroy and the call this method to remove the EJB.

                3. If you use the EntityManager and Hibernate then clear it sometimes.

                 

                But that are only suggestions.