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
I changed this parameters at Run Configurations:
But I still get the same error. Am I missing something?
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.
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.
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/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With