Reputation: 509
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?
Upvotes: 6
Views: 41496
Reputation: 1488
If we are using windows try this:
Try setting a Windows System Environment variable called _JAVA_OPTIONS with the heap size you want. Java should be able to find it and act accordingly
Below settings workes for me : -Xms512m -Xmx1024m -XX:MaxPermSize=512m
Upvotes: 1
Reputation: 16
Assuming you have 4gb or more RAM, try something like this in eclipse.ini(notice the capital/small letter "m"):
--launcher.XXMaxPermSize
1024M
--launcher.XXMaxPermSize
1024m
-vmargs
-Xms512m
-Xmx2048m
Upvotes: 0
Reputation:
Where is the "vmargs" option? If you set the min/max heap, you probably need to do it on the main process, not the launcher.
See the Eclipse FAQ item on setting VM options.
That launcher PermSize opt is a bit ridiculous. Unless you know it is launcher PermSize causing the OOM, keep it at the default of 256m.
[EDIT]
As pointed out else-thread, if this is happening when you run your Java program from Eclipse, you tweak those settings within the "Run Configuration" for that program, not Eclipse.ini.
Also, remember that you can tweak the VM options all you want, but if the program wants to eat all the resources on the box before it OOMs, no amount of tweaking can mitigate this.
Upvotes: 2
Reputation: 1086
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/
Upvotes: 3