ANT build java heap space

I'm getting a java heap space error when running an ANT build script that targets the flex sdk flex_sdk_4.5.0.17689. I know this is typically a memory issue and I have tried to allocate 1024mb of memory everwhere I could on my system I can't get it to compile. I've been able to compile this for months and this has just started to happen.

If anyone has any ideas on what i could do to fix this, you would rock!

7 comments

Hi Dave!
How does your question relates to IntelliJ IDEA?

0

Because its my ANT plugin in intelliJ that is causing the issue. The other devs here are on eclipse using ANT (and on the same code-base), do not have the same issue. Sorry I thought it was implied that I was using ANT in intelliJ.

0

Please make sure that you increased heap in a correct place. You need to click 'Properties' button in IDEA's Ant tool window and edit 'Maximum heap size (Mb)' field there.
heap.png

0

Yeah that is why I am so confused, that did not fix the problem. I increased my memory size to 1GB (I have 8GB available) and I'm still getting the same error.



Attachment(s):
heapsize.jpg
0

I don't think you need to increase stack size. Java's default is 512K and if it is overflowed that usually means that there's a bug in a program. Increasing the value only makes program hang for longer period until StackOverflowError. I'm not sure that this value should be measured in Megabytes.

Well, how big is the project being built? Which heap is enough for it when launching ant from command line? Please paste a screenshot with the error (and some stacktrace is probably available).

0

its a fairly large flash module that I'm trying to compile, the other smaller modules in this project are able to compile. This one is around 650k when complete

this is the output i get after trying to compile:

/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/bin/java -Xmx1024m -Xss64m -Dant.home=/Applications/IntelliJ IDEA 10.app/lib/ant -Dfile.encoding=UTF-8 -classpath /System/Library/Frameworks/JavaVM.framework/Versions/A/Resources/Deploy.bundle/Contents/Resources/Java/deploy.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Classes/dt.jar:/System/Library/Frameworks/JavaVM.framework/Versions/A/Resources/Deploy.bundle/Contents/Resources/Java/javaws.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Classes/jce.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Classes/management-agent.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/lib/sa-jdi.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Classes/alt-rt.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Classes/charsets.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Classes/classes.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Classes/jconsole.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Classes/jsse.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Classes/laf.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Classes/ui.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/lib/ext/apple_provider.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/lib/ext/dnsns.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/lib/ext/localedata.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/lib/ext/sunjce_provider.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/lib/ext/sunpkcs11.jar:/Applications/IntelliJ IDEA 10.app/lib/ant/lib/ant-antlr.jar:/Applications/IntelliJ IDEA 10.app/lib/ant/lib/ant-apache-bcel.jar:/Applications/IntelliJ IDEA 10.app/lib/ant/lib/ant-apache-bsf.jar:/Applications/IntelliJ IDEA 10.app/lib/ant/lib/ant-apache-log4j.jar:/Applications/IntelliJ IDEA 10.app/lib/ant/lib/ant-apache-oro.jar:/Applications/IntelliJ IDEA 10.app/lib/ant/lib/ant-apache-regexp.jar:/Applications/IntelliJ IDEA 10.app/lib/ant/lib/ant-apache-resolver.jar:/Applications/IntelliJ IDEA 10.app/lib/ant/lib/ant-apache-xalan2.jar:/Applications/IntelliJ IDEA 10.app/lib/ant/lib/ant-commons-logging.jar:/Applications/IntelliJ IDEA 10.app/lib/ant/lib/ant-commons-net.jar:/Applications/IntelliJ IDEA 10.app/lib/ant/lib/ant-jai.jar:/Applications/IntelliJ IDEA 10.app/lib/ant/lib/ant-javamail.jar:/Applications/IntelliJ IDEA 10.app/lib/ant/lib/ant-jdepend.jar:/Applications/IntelliJ IDEA 10.app/lib/ant/lib/ant-jmf.jar:/Applications/IntelliJ IDEA 10.app/lib/ant/lib/ant-jsch.jar:/Applications/IntelliJ IDEA 10.app/lib/ant/lib/ant-junit.jar:/Applications/IntelliJ IDEA 10.app/lib/ant/lib/ant-launcher.jar:/Applications/IntelliJ IDEA 10.app/lib/ant/lib/ant-netrexx.jar:/Applications/IntelliJ IDEA 10.app/lib/ant/lib/ant-nodeps.jar:/Applications/IntelliJ IDEA 10.app/lib/ant/lib/ant-swing.jar:/Applications/IntelliJ IDEA 10.app/lib/ant/lib/ant-testutil.jar:/Applications/IntelliJ IDEA 10.app/lib/ant/lib/ant.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/lib/tools.jar:/Applications/IntelliJ IDEA 10.app/lib/idea_rt.jar com.intellij.rt.ant.execution.AntMain2 -logger com.intellij.rt.ant.execution.IdeaAntLogger2 -inputhandler com.intellij.rt.ant.execution.IdeaInputHandler -buildfile /Users/david.padovano/Sites/droid-space-refactor/build.xml compile phone
build.xml
property
property
taskdef
Could not load definitions from resource flexUnitTasks.tasks. It could not be found.
taskdef
import
macrodef
macrodef
macrodef
import
import
import
import
import
import
import
import
compile phone
runtarget
compile-phones.compile-phones
echo
echo
if
property
property
property
java
Loading configuration file /sdks/flex_sdk_4.5.0.17689/frameworks/flex-config.xml
/Users/david.padovano/Sites/droid-space-refactor/src/com/bowen/droiddoes/core/ITimelineDecoration.as(23): col: 47 Warning: return value for function 'navigation' has no type declaration.

    function set navigation(value:NavigationView)
                                                 ^

/Users/david.padovano/Sites/droid-space-refactor/src/com/bowen/droiddoes/core/TimelineDecorator.as(78): col: 54 Warning: return value for function 'navigation' has no type declaration.

    public function set navigation(value:NavigationView)
                                                        ^

Error: Java heap space

/Users/david.padovano/Sites/droid-space-refactor/build/build-includes/compile-phones.xml:26: Java returned: 1
    at org.apache.tools.ant.taskdefs.Java.execute(Java.java:111)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
    at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.Target.execute(Target.java:390)
    at org.apache.tools.ant.Target.performTasks(Target.java:411)
    at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1397)
    at org.apache.tools.ant.Project.executeTarget(Project.java:1366)
    at net.sf.antcontrib.logic.RunTargetTask.execute(RunTargetTask.java:48)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
    at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.Target.execute(Target.java:390)
    at org.apache.tools.ant.Target.performTasks(Target.java:411)
    at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1397)
    at org.apache.tools.ant.Project.executeTarget(Project.java:1366)
    at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
    at org.apache.tools.ant.Project.executeTargets(Project.java:1249)
    at org.apache.tools.ant.Main.runBuild(Main.java:801)
    at org.apache.tools.ant.Main.startAnt(Main.java:218)
    at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
    at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.intellij.rt.ant.execution.AntMain2.main(AntMain2.java:32)
/Users/david.padovano/Sites/droid-space-refactor/build/build-includes/compile-phones.xml:26: Java returned: 1
    at org.apache.tools.ant.taskdefs.Java.execute(Java.java:111)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
    at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.Target.execute(Target.java:390)
    at org.apache.tools.ant.Target.performTasks(Target.java:411)
    at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1397)
    at org.apache.tools.ant.Project.executeTarget(Project.java:1366)
    at net.sf.antcontrib.logic.RunTargetTask.execute(RunTargetTask.java:48)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
    at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.Target.execute(Target.java:390)
    at org.apache.tools.ant.Target.performTasks(Target.java:411)
    at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1397)
    at org.apache.tools.ant.Project.executeTarget(Project.java:1366)
    at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
    at org.apache.tools.ant.Project.executeTargets(Project.java:1249)
    at org.apache.tools.ant.Main.runBuild(Main.java:801)
    at org.apache.tools.ant.Main.startAnt(Main.java:218)
    at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
    at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.intellij.rt.ant.execution.AntMain2.main(AntMain2.java:32)
/Users/david.padovano/Sites/droid-space-refactor/build/build-includes/compile-phones.xml:26: Java returned: 1
    at org.apache.tools.ant.taskdefs.Java.execute(Java.java:111)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
    at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.Target.execute(Target.java:390)
    at org.apache.tools.ant.Target.performTasks(Target.java:411)
    at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1397)
    at org.apache.tools.ant.Project.executeTarget(Project.java:1366)
    at net.sf.antcontrib.logic.RunTargetTask.execute(RunTargetTask.java:48)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
    at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.Target.execute(Target.java:390)
    at org.apache.tools.ant.Target.performTasks(Target.java:411)
    at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1397)
    at org.apache.tools.ant.Project.executeTarget(Project.java:1366)
    at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
    at org.apache.tools.ant.Project.executeTargets(Project.java:1249)
    at org.apache.tools.ant.Main.runBuild(Main.java:801)
    at org.apache.tools.ant.Main.startAnt(Main.java:218)
    at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
    at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.intellij.rt.ant.execution.AntMain2.main(AntMain2.java:32)
/Users/david.padovano/Sites/droid-space-refactor/build/build-includes/compile-phones.xml:26: Java returned: 1
    at org.apache.tools.ant.taskdefs.Java.execute(Java.java:111)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
    at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.Target.execute(Target.java:390)
    at org.apache.tools.ant.Target.performTasks(Target.java:411)
    at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1397)
    at org.apache.tools.ant.Project.executeTarget(Project.java:1366)
    at net.sf.antcontrib.logic.RunTargetTask.execute(RunTargetTask.java:48)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
    at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.Target.execute(Target.java:390)
    at org.apache.tools.ant.Target.performTasks(Target.java:411)
    at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1397)
    at org.apache.tools.ant.Project.executeTarget(Project.java:1366)
    at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
    at org.apache.tools.ant.Project.executeTargets(Project.java:1249)
    at org.apache.tools.ant.Main.runBuild(Main.java:801)
    at org.apache.tools.ant.Main.startAnt(Main.java:218)
    at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
    at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.intellij.rt.ant.execution.AntMain2.main(AntMain2.java:32)
/Users/david.padovano/Sites/droid-space-refactor/build/build-includes/compile-phones.xml:26: Java returned: 1
    at org.apache.tools.ant.taskdefs.Java.execute(Java.java:111)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
    at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.Target.execute(Target.java:390)
    at org.apache.tools.ant.Target.performTasks(Target.java:411)
    at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1397)
    at org.apache.tools.ant.Project.executeTarget(Project.java:1366)
    at net.sf.antcontrib.logic.RunTargetTask.execute(RunTargetTask.java:48)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
    at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.Target.execute(Target.java:390)
    at org.apache.tools.ant.Target.performTasks(Target.java:411)
    at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1397)
    at org.apache.tools.ant.Project.executeTarget(Project.java:1366)
    at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
    at org.apache.tools.ant.Project.executeTargets(Project.java:1249)
    at org.apache.tools.ant.Main.runBuild(Main.java:801)
    at org.apache.tools.ant.Main.startAnt(Main.java:218)
    at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
    at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.intellij.rt.ant.execution.AntMain2.main(AntMain2.java:32)

Ant build completed with 5 errors one warning in 27s at 4/29/11 3:18 PM

0

There's nothing magic in the way IDEA executes ant tasks. It just launches separate java process. So I can hardly imagine what kind of bug in IDEA could lead to problems like yours.
So all I can suggest is not really related to IDEA:
- decrease stack size to 1Mb. Unless you get unexpected StackOverflowError - no need in increasing it.
- increase heap just more
- try different version of ant
- try the same command as IDEA uses from command line

Is OutOfMemory stack trace the same each time you launch this task? What is there in compile-phones.xml:26?

0

Please sign in to leave a comment.