Win a copy of Head First Android this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

java.lang.OutOfMemoryError: Java heap space

 
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi friends

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

https://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
 
Bartender
Posts: 1638
IntelliJ IDE MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
     
    author
    Posts: 5856
    7
    Android Eclipse IDE Ubuntu
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • 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
    Posts: 5856
    7
    Android Eclipse IDE Ubuntu
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • 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
      Number of slices to send:
      Optional 'thank-you' note:
    • 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

     
    Ranch Hand
    Posts: 48
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • 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
     
    Ranch Hand
    Posts: 466
    1
    IntelliJ IDE Oracle Java
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Do heap dump analysis.
     
    You showed up just in time for the waffles! And this tiny ad:
    Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    reply
      Bookmark Topic Watch Topic
    • New Topic