Sunday, November 14, 2021

[SOLVED] Eclipse: Java heap space, How to fix it?

Issue

i have an error at eclipse for a long time and i searched in stackoverflow for a solution, i found two diffirent suggestions but i try it without success.

First try, was to change the eclipse.ini file with the following changes,

Try allocating more heap space to eclipse. Go to eclipse.ini file in the eclipse directory and change heap space parameter.

-XX:MaxPermSize=256m
-Xms128m
-Xmx512m

the second try is to start eclipse with a command like this :

eclipse -vmargs -XX:PermSize=128M -XX:MaxPermSize=512M

Sometimes it is working but after few hours the problem is back and sometimes i cannot solve this so i am waiting one day and the problem is away and it is coming again after some days. How can i fix it, because i cannot work on my project.

I am on Fedora 20.


Solution

The memory usage depends on what do you do in the Eclipse and which plugins you have installed, but according to my experience 512Mb is not enough for comfortable work. I use for Eclipse Luna 64bit (eclipse.ini):

-Xms128m
-Xmx1200m

With these settings I can have Eclipse opened for a week with hundreds of source files opened without having OutOfMemoryError.

Note that PermSize/MaxPermSize option is obsolete since Java-8 (it does not actually change anything).



Answered By - Tagir Valeev