Reputation: 415
I have given loads of memory to eclipse in the ini file but its still not using anything more than 300mb which i can see in the task manager.
[javac] The system is out of resources.
[javac] Consult the following stack trace for details.
[javac] java.lang.OutOfMemoryError: Java heap space
[javac] at com.sun.tools.javac.comp.Attr.selectSym(Attr.java:1938)
[javac] at com.sun.tools.javac.comp.Attr.visitSelect(Attr.java:1835)
[javac] at com.sun.tools.javac.tree.JCTree$JCFieldAccess.accept(JCTree.java:1522)
[javac] at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:360)
[javac] at com.sun.tools.javac.comp.Attr.attribExpr(Attr.java:377)
[javac] at com.sun.tools.javac.comp.Annotate.enterAttributeValue(Annotate.java:190)
[javac] at com.sun.tools.javac.comp.Annotate.enterAnnotation(Annotate.java:167)
[javac] at com.sun.tools.javac.comp.MemberEnter.enterAnnotations(MemberEnter.java:743)
[javac] at com.sun.tools.javac.comp.MemberEnter.access$300(MemberEnter.java:42)
[javac] at com.sun.tools.javac.comp.MemberEnter$5.enterAnnotation(MemberEnter.java:711)
[javac] at com.sun.tools.javac.comp.Annotate.flush(Annotate.java:95)
[javac] at com.sun.tools.javac.comp.Annotate.enterDone(Annotate.java:87)
[javac] at com.sun.tools.javac.comp.Enter.complete(Enter.java:485)
[javac] at com.sun.tools.javac.comp.Enter.main(Enter.java:442)
[javac] at com.sun.tools.javac.main.JavaCompiler.enterTrees(JavaCompiler.java:819)
[javac] at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:727)
[javac] at com.sun.tools.javac.main.Main.compile(Main.java:353)
[javac] at com.sun.tools.javac.main.Main.compile(Main.java:279)
[javac] at com.sun.tools.javac.main.Main.compile(Main.java:270)
[javac] at com.sun.tools.javac.Main.compile(Main.java:69)
[javac] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[javac] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[javac] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[javac] at java.lang.reflect.Method.invoke(Method.java:597)
[javac] at org.apache.tools.ant.taskdefs.compilers.Javac13.execute(Javac13.java:56)
[javac] at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:1065)
[javac] at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:882)
[javac] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
[javac] at sun.reflect.GeneratedMethodAccessor19.invoke(Unknown Source)
[javac] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[javac] at java.lang.reflect.Method.invoke(Method.java:597)
[javac] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
this is my ini file which i have.
--launcher.defaultAction
openFile
--launcher.XXMaxPermSize
512M
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize1024m
--vm
C:\Program Files\Java\jdk1.6.0_24\bin\javaw.exe -vmargs -Xms512m -Xmx1024m
I have no idea why it wont use the memory I am giving it. Do i need to do anything else to change the heap size?
Thanks
Upvotes: 12
Views: 41554
Reputation: 3429
I had the same problem a week ago, and the solution was set fork attribute to true, to run javac in a separate process with its own heap size settings. If fork is set to false, or not set (default is false), javac will run in the same process as Ant. The following is a snippet from my current build.xml:
<javac fork="true"
srcdir="${basedir}/src"
.....
</javac>
Setting fork to true will also limit any memory leaks in javac implementation to its own child process, without affecting the parent Ant process. I read about this hint here
Upvotes: 0
Reputation: 3125
You can properly set the -Xms512m
-Xmx1024m
options to the Ant bin/sh script that Eclipse will run once you launch a build.
plugins > org.apache.ant_<version> > bin
Modify the OS related Ant file
For Windows: Add this line to the ant.bat
file export ANT_OPTS=-Xmx512m
For Unix/Mac OS X: You can directly edit the ant_exec_command
command at the end of the ant
file or setting the $ANT_ARGS
variable
Upvotes: 0
Reputation: 12054
your eclipse.ini settings will take effect only if u 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
this worked 4 me
Upvotes: 4
Reputation: 25381
Not Eclipse is running out of memory, but ant. Ant is run as an external tool from eclipse, so it does not inherit the VM settings you are using for eclipse. You can set the options for it in the external tool run configuration. Go to Run -> External Tools -> External Tool Configurations... Then under "Ant Builds" you have to look up your ant build, and you can set the vm arguments in the JRE tab.
Upvotes: 18