5

So lately I'm having a problem while working in my apps inside eclipse the next message shows up while working with xml files:

ERROR: 'Java heap space'

I have read an try increasing inside the eclipse.ini file the:

-vmargs
-Xmx40m
-Xmx512m

to:

-vmargs
-Xmx512m
-Xmx1024m 

but it will work for a while than after and hour or so it will give me the same error, I'm working in a MacBook air with 4gb ram. I have Eclipse SDK Version: 3.7.2 Build id: M20120208-0800 and I just updated it, so I don't know if that is why is acting up this way, this is how my eclipse.ini looks right now:

-startup
../../../plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar
--launcher.library
../../../plugins/org.eclipse.equinox.launcher.cocoa.macosx.x86_64_1.1.101.v20120109-1504
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
-vmargs
-Xmx512m
-Xmx1024m
-Xdock:icon=../Resources/Eclipse.icns
-XstartOnFirstThread
-Dorg.eclipse.swt.internal.carbon.smallFonts

what else can I do to fix this? any help is really appreciated. thanks in advance.

zvzej
  • 6,276
  • 7
  • 33
  • 41

1 Answers1

6

Try this

In Run->Run Configuration find the Name of the class you have been running, select it, click the Arguments tab then add:

  -Xms512M -Xmx1524M

to the VM Arguments section

Few useful links

What are the best JVM settings for Eclipse?

Error "java heap size" in Eclipse Android?

Edit:

Your eclipse.ini settings will take effect only if you change following:

Run -> External Tools -> External Tool

Configurations. go to configuration that u use, under jre tab -select option

Run in same JRE in workspace.

Community
  • 1
  • 1
Raghunandan
  • 132,755
  • 26
  • 225
  • 256
  • I have try to follow your instructions but can't find a Arguments tab....I can see a list of my apps, when I choose the one I'm working on there are 3 tabs to the right Android, Target and Common am I missing something? thanks – zvzej May 24 '13 at 19:30
  • I'm doing Run-External tool-External Tool Conf.... but in there I can see in the left: Ant Build, API use report and Program – zvzej May 24 '13 at 19:37
  • @zvzej http://stackoverflow.com/questions/142357/what-are-the-best-jvm-settings-for-eclipse. you can click the ant build too. go to jre there you will find the option run in same jre workspace – Raghunandan May 24 '13 at 19:41
  • @zvzej try whats mentioned in the above comment and let me know – Raghunandan May 24 '13 at 19:45
  • I'm sorry its going to take me a while, now eclipse is not building my jar files in any application!!! – zvzej May 24 '13 at 19:52
  • the vote you see is mine I did it las Friday when you helped me. – zvzej May 27 '13 at 18:13
  • Is there another way or the best way to increase the java heap space? the problem has return and I cannot work in eclipse! please help me. – zvzej Jun 29 '13 at 18:30
  • repeat the above steps or reinstall eclipse by downloading a fresh copy – Raghunandan Jun 29 '13 at 18:31
  • I already try the steps with out luck, do you really think reinstalling a new copy of eclipse will work? – zvzej Jun 29 '13 at 18:43
  • @zvzej try it out. there is no harm in trying. keep the old one and isntall it on a different drive. – Raghunandan Jun 29 '13 at 18:44
  • I tried the Run -> External Tools -> External Tool Configurations -> New -> jre Tab -> select "run in same jre workspace" as mention by Raghunandan. It seem like my application do not have the same error and run faster but on the other hand is still quite slow (just a bit faster than before). @zvzej: Hope that it will help for you as I have similar spec as yours. – Lee Yi Hong Jul 03 '14 at 06:46
  • 1
    there is no such option available in Eclipse, this answer is false. – Sandeep Londhe Aug 20 '15 at 13:58
  • @AndroidHacker Are you sure??. I answered this in 2013 @ that time this answered worked and i checked this before posting it as an answer. It might still work. But android studio is the official IDE for android. Better switch to android studio. – Raghunandan Aug 20 '15 at 15:01
  • If you provide me the way to get rid of heap space error in eclipse, that will be good, My current IDE is Eclipse only, not able to switch. thank u. @Raghunandan – Sandeep Londhe Aug 20 '15 at 15:25
  • @AndroidHacker then its not late to switch. All samples from google also have gradle build. You should switch ASAP. As for the solution i cannot try this again cause i do not have eclipse installed on my system now. – Raghunandan Aug 20 '15 at 15:29