Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java.lang.OutOfMemoryError: Java heap space

 
priya pratheepp
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1638
IntelliJ IDE Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
     
    Peter Johnson
    author
    Bartender
    Posts: 5852
    7
    Android Eclipse IDE Ubuntu
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    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.)
     
    Peter Johnson
    author
    Bartender
    Posts: 5852
    7
    Android Eclipse IDE Ubuntu
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    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
    Posts: 59
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    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
    Posts: 48
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    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
    Posts: 466
    1
    IntelliJ IDE Java Oracle
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Do heap dump analysis.
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic