Pages

Monday, January 27, 2014

Eclipse Debug: Java Heap Out of Memory Problem

Recently, I've been hearing this comment from new java developers
java.lang.OutOfMemoryError: Java heap space

It only means that the allocated java memory is not enough, mainly the allocated runtime memory.

I've found a good resource that will give you instruction on how to update JRE memory in Windows 7.
http://www.wikihow.com/Increase-Java-Memory-in-Windows-7

1) Go to Control Panel
2) Search for Java
3) Go to Java tab
4) Click View
5) (from the link post above)
Modify the parameter. To modify the parameter, double click in the "Runtime Parameters" column and,
type -Xmx512m that assigns 512MB memory for the Java.
type -Xmx1024m that assigns 1GB memory for the Java.
type -Xmx2048m that assigns 2GB memory for the Java.
type -Xmx3072m that assigns 3GB memory for the Java, and so on.
Please note, it begins with a minus sign and ends to an m.
Also note, there is no blank space between characters.

PS: I'm putting this here as a bookmark or note for myself. So if this is helping you too, then thanks to wikihow for posting the direction. :)

More notes about JVM memory below:


This is a quick picture explanation of what a heap memory and non-heap memory is.
Got the image from this website: JVM Memory and Java Heap Space

Another good resource with lots of parameter arguments, check it out here: JVM Heap Space Arguments