• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Exception

 
Hrishikesh Hemade
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space


does any one now Why this exception is coming,earlier code was working fine. Can anyone help

Thank you
 
Lakshmanan Arunachalam
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if this error occured after adding sme piece of code to an already running application, then your new code have created a lot of objects and filled the heap size and lead to outof memory err.\

Check for

1. Any recursive calls which create a lot of objects
2. Check for the scope of the objects, may be you were trying to add objects to a static container object. Hence objects were not eligible for Garbage collection.
3. Any socket related operations that lead to consuming a lot of resources.

In simple, your code is stopping GC from doing its work !!(by keeping live references for unnecessary objects)

Let me know if you have any questions
 
Hrishikesh Hemade
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you
 
Hrishikesh Hemade
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actully i have changed JVM heap memory -Xms to something i have changed it after doing this thing it's give me the error. So anyone know how to fix it. I have removed the -Xms.

Thank you
 
Sri Ram
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Xms<size> size ------> set initial Java heap size

This is a JVM parameters u set when u execute ur Program. the Xms set the initial Heap size. When u allocate very less space, u probably get this error.
 
Hrishikesh Hemade
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you,
but what is the default Xms for JVM. I have deleted the -Xms entry.

Thank you
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic