Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

eclipse with Android sdk, ERROR: Java heap space

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.

like image 915
zvzej Avatar asked May 24 '13 18:05

zvzej


People also ask

How do I fix Java heap space in eclipse?

Temporary fix – Increase the heap size On the Eclipse menu, clicks Run -> Run Configurations.. , select the Java application we want to run, click on the Arguments tab, VM arguments section, and adjust a better Java initial maximum heap size.

How do I fix Java out of memory error heap space?

OutOfMemoryError: Java heap space. 1) An easy way to solve OutOfMemoryError in java is to increase the maximum heap size by using JVM options "-Xmx512M", this will immediately solve your OutOfMemoryError.

How do I fix a heap space error?

The java. lang. OutOfMemoryError: Java heap space error occurs when it attempts to add more data into the heap space area, but there is not enough room for it. The solution to fix this problem is to increase the heap space(Default value maybe 128 MB).


1 Answers

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.

like image 152
Raghunandan Avatar answered Nov 14 '22 23:11

Raghunandan