This error message can occour while running your application.The error 'java.lang.OutOfMemoryError: Java heap space' is caused when the JVM (Java Virtual Machine) runs out of available memory during processing. This can be caused by:
* a system with less memory than your application / VM requires.
Sample program that causes this error:GeSHi (java):
import java.util.Vector;
/*--------------------------------------------------------------------------
//Author List:
// deAppel <Creator>
//
//Description:
// Showing java.lang.OutOfMemoryError
//
//Environment:
// This software was developed using Eclipse and Java 1.6
//
//Copyright Information:
// Copyright (C) 2007 <Institution><None>
// Ark de Appel www.engineeringserver.com
//
//----------------------------------------------------------------------*/
public class OutOfMemory {
public static void main
(String[] args
) { boolean tmp = true;
int i = 0;
while (tmp == true) {
v.add(i);
i++;
}
}
}
Created by GeSHI 1.0.7.20
When you run this you will get:Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
at java.util.Vector.ensureCapacityHelper(Unknown Source)
at java.util.Vector.add(Unknown Source)
at OutOfMemory.main(OutOfMemory.java:10)
Why?Because
tmp is always true, the while loop never stops and it continues to add the variable
i into the vector until the JVM runs out of memory.
Solution(s): * add more RAM
* typ: java -Xmx256m in your console window or java -XmxYYYm where YYY is the amount of memory you want to set.
Reference:http://bliki.rimuhosting..../linux/java/-Xmx+settingshttp://edocs.bea.com/wls/...61/perform/JVMTuning.htmlhttp://forum.java.sun.com...read.jspa?threadID=745025