This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Java in General and the fly likes Memory heap error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Memory heap error" Watch "Memory heap error" New topic
Author

Memory heap error

Jesus Angeles
Ranch Hand

Joined: Feb 26, 2005
Posts: 2057
Hi,

I am getting this below.



The program needs lots of memory.

Is it possible to increase the heap memory for my program?
Ryan Beckett
Ranch Hand

Joined: Feb 22, 2009
Posts: 192
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space

This can have two reasons:

* Your Java application has a memory leak. There are tools like YourKit Java Profiler that help you to identify such leaks.
* Your Java application really needs a lot of memory (more than 128 MB by default!). In this case the Java heap size can be increased using the following runtime parameters:

java -Xms<initial heap size> -Xmx<maximum heap size>

Defaults are:

java -Xms32m -Xmx128m



Increase Java Heap Size
Jesus Angeles
Ranch Hand

Joined: Feb 26, 2005
Posts: 2057
Thank you Ryan.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Memory heap error