Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't solve "Java heap space" error in eclipse

While running my Java code in Eclipse IDE, I got the error:

Exception in thread "D3D Screen Updater" Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space

I searched for this error and tried solutions described here and here, but they did not work.

I changed these parameters in eclipse.ini:

--launcher.XXMaxPermSize

512M

-Xms40m

-Xmx512m

to:

--launcher.XXMaxPermSize

1024M

-Xms512m

-Xmx2048m

EDIT:

I changed this parameters at Run Configurations:

enter image description here

But I still get the same error. Am I missing something?

like image 917
Rikkin Avatar asked Nov 25 '14 16:11

Rikkin


People also ask

How do I increase the heap size available to Eclipse?

Since Eclipse is a Java program, you can increase the heap size of Eclipse by using JVM memory options -Xms and -Xmx. There are two ways to provide JVM options to eclipse either updating the Eclipse shortcut or adding -vmargs on eclipse. ini file.

What causes Java heap space error?

Usually, this error is thrown when there is insufficient space to allocate an object in the Java heap. In this case, The garbage collector cannot make space available to accommodate a new object, and the heap cannot be expanded further.


1 Answers

The memory settings in eclipse.ini is allocated to Eclipse IDE only, not the program you want to run. A very common mistake is updated the heap size in eclipse.ini, and expects it to solve above out of memory problem.

http://www.mkyong.com/eclipse/eclipse-java-lang-outofmemoryerror-java-heap-space/

like image 90
elsadek Avatar answered Sep 21 '22 18:09

elsadek