File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Performance and the fly likes java.lang.OutOfMemoryError: Java heap space Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Performance
Bookmark "java.lang.OutOfMemoryError: Java heap space" Watch "java.lang.OutOfMemoryError: Java heap space" New topic
Author

java.lang.OutOfMemoryError: Java heap space

priya pratheepp
Ranch Hand

Joined: Apr 02, 2008
Posts: 59
Hi friends

I am getting java.lang.OutOfMemoryError: Java heap space error.I read the thread

http://www.coderanch.com/t/87530/Tomcat/Out-memory-Tomcat
I can come to any conclution.with the help of line



at the begining of the program i got
Java memory in use = 10939448

at the end of program i got
Java memory in use = 44747512

-Xms512m -Xmx512m ble bla ......

Please help me to sort out my problem

thanks in advance
Nitesh Kant
Bartender

Joined: Feb 25, 2007
Posts: 1638

There are only two ways of dealing with the OutOfMemoryException:

  • Reduce program memory consumption. The heap usage can be analysed using tools like jhat.
  • Increase memory allocated to the JVM using the -Xms and -Xmx JVM options.


  • You need to decide, what is it that you want to do. Show us some efforts, give enough information and we will be happy to help.


    apigee, a better way to API!
    Peter Johnson
    author
    Bartender

    Joined: May 14, 2008
    Posts: 5811
        
        7

    You need to track what the garbage collector is doing. See my paper at ceCMG for one way you could do this. (And no, using JConsole does not provide the necessary information - you need to know how much heap space is in use after each major collection.)


    JBoss In Action
    Peter Johnson
    author
    Bartender

    Joined: May 14, 2008
    Posts: 5811
        
        7

    Oh, the other option is to read the performance chapter of JBoss In Action where I go into this in detail. Most of the chapter applies to Java apps in general, not just to JBossAS.
    priya pratheepp
    Ranch Hand

    Joined: Apr 02, 2008
    Posts: 59
    Hi

    answer to my post helped me a lot..my problem solved.many string buffer caused main problem and some more too..

    thanks for tutorials

    leonardo ginting
    Ranch Hand

    Joined: Jul 25, 2011
    Posts: 48
    priya pratheepp wrote:Hi

    answer to my post helped me a lot..my problem solved.many string buffer caused main problem and some more too..

    thanks for tutorials




    hi priya i recently got this error and i dont know how to solve this case and ive been increasing my memory on my run.conf



    but im still getting this error?

    how could i fix this? i have many setter and getter method does this method affect consuming the memory or causing java heap space?

    thanks
    Vinod Tiwari
    Ranch Hand

    Joined: Feb 06, 2008
    Posts: 459
        
        1
    Do heap dump analysis.


    Vinod Tiwari | Twitter
     
    Consider Paul's rocket mass heater.
     
    subject: java.lang.OutOfMemoryError: Java heap space
     
    Similar Threads
    Out of memory error
    java.lang.OutOfMemoryError: Java heap space
    Avoiding Heap Space Memory Problem
    JAVA HEAP SIZE and files to byte[]-Array
    Memory heap error