9 Replies Latest reply on Nov 27, 2002 3:56 AM by Tushar Swarnakar

    OutOfMemoryError

    Ralph Espinola Newbie

      I am running an EJB that performs alot of image generation that passes back large images to a client over a network. The images are about 200 megabytes each. The EJB is able to send a few, but then will eventually return an OutOfMemoryError. Before I create the new BufferedImage, I run a Runtime.getRuntime().freeMemory() and I have over 900megs free each time, even in the time I receive the Error. Any ideas why i am running of out memory?

        • 1. 3829757
          dhillipa dhillipa Newbie

          Try increasing the heap size of JVM

          • 2. Re: OutOfMemoryError
            dhillipa dhillipa Newbie

            increase the heap size by setting the java options ..........

            • 3. Re: OutOfMemoryError
              Ralph Espinola Newbie

              I was running it with -Xms1024m -Xmx1024m and I was still receiving the error, any other ideas?

              Thanks.

              • 4. Re: OutOfMemoryError
                Joel Vogt Master

                *shrug* buy more memory? Short of this, see how you go with smaller images, and then try to bump up the size until it breaks. That way should be able to see if it is jboss or app problem

                • 5. Re: OutOfMemoryError
                  Juha Lindfors Master

                  also use something like OptimizeIT to track down the memory usage, runtime.getFreeMem() isn't that reliable.

                  • 6. Re: OutOfMemoryError
                    Ralph Espinola Newbie

                    Here is the error I get:

                    java.rmi.ServerError: Error occurred in server thread; nested exception is:
                    java.lang.OutOfMemoryError
                    java.lang.OutOfMemoryError
                    at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:245)
                    at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:220)
                    ...

                    This happens right at the code that returns to the client from the server. Right before I send the object back, I check the free memory and I have over 8Gigs left (-Xms8G -Xmx10G) The object being sent is about 300 megs. I also have a try catch block for OutOfMemoryError's on the server side code, wrapped around the return, and I get no errors on the JBoss console. I am using JBoss3.0.0.
                    Therefore, I am thinking there is something happening from the time it leaves the server and the time it reaches the client.

                    Any ideas??

                    • 7. Re: OutOfMemoryError
                      Ralph Espinola Newbie

                      This is the error I get:

                      java.rmi.ServerError: Error occurred in server thread; nested exception is:
                      java.lang.OutOfMemoryError
                      java.lang.OutOfMemoryError
                      at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:245)
                      at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:220)
                      ...

                      This happens right at the code that returns to the client from the server. Right before I send the object back, I check the free memory and I have over 8Gigs left (-Xms8G -Xmx10G) The object being sent is about 300 megs. I also have a try catch block for OutOfMemoryError's on the server side code, wrapped around the return, and I get no errors on the JBoss console. I am using JBoss3.0.0.
                      Therefore Im thinking somethign is happening from the time it leaves the serer to the time the client gets the object.


                      Any ideas??

                      • 8. Re: OutOfMemoryError
                        Daniel Sieroka Newbie

                        One thing that usually helps Java is using -Xincgc

                        • 9. Re: OutOfMemoryError
                          Tushar Swarnakar Newbie

                          I think I am little bit late. But you can try one thing. Check number of processes created by Java. If your JBoss server is running on Linux then there might be problem to create a new thread. You can shift your JBoss application server to WindowsNT and check once again. Because thread management is much better in WindowsNT than LInux.
                          Regards
                          Tushar