Apr 10, 2009

Error: java.lang.OutOfMemoryError: Java heap space

If Java runs out of memory, the following error occurs:

Exception in thread "main" java.lang.OutOfMemoryError: Java heap space

or

Exception in thread "main" java.lang.OutOfMemoryError: PermGen space

java -Xms[initial heap size] -Xmx[maximum heap size] -XX:MaxPermSize=[maximum permanent size]

Example:

java -Xms128m -Xmx256m -XX:MaxPermSize=256m

1 comment:

sagar said...

Ya,its working.
Thanks.