[groovy-user] java.lang.OutOfMemoryError: Java heap space

907 views
Skip to first unread message

Bartosz

unread,
Oct 2, 2012, 4:42:21 AM10/2/12
to us...@groovy.codehaus.org
While compiling groovy scripts using
org.codehaus.groovy.ant.Groovyc.execute(...) method I'm getting
following exception:

[exec] Exception in thread "main" java.lang.OutOfMemoryError:
Java heap space
[exec] at
org.codehaus.groovy.classgen.BytecodeHelper.getClassLoadingTypeDescription(BytecodeHelper.java:182)
[exec] at
org.codehaus.groovy.classgen.AsmClassGenerator.createSyntheticStaticFields(AsmClassGenerator.java:3083)
[exec] at
org.codehaus.groovy.classgen.AsmClassGenerator.visitClass(AsmClassGenerator.java:281)
[exec] at
org.codehaus.groovy.control.CompilationUnit$11.call(CompilationUnit.java:738)
[exec] at
org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:932)
[exec] at
org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:509)
[exec] at
org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:487)
[exec] at
org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:464)
[exec] at
org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:448)
[exec] at
org.codehaus.groovy.tools.FileSystemCompiler.compile(FileSystemCompiler.java:57)
[exec] at
org.codehaus.groovy.tools.FileSystemCompiler.doCompilation(FileSystemCompiler.java:170)
[exec] at org.codehaus.groovy.ant.Groovyc.compile(Groovyc.java:895)
[exec] at org.codehaus.groovy.ant.Groovyc.execute(Groovyc.java:605)

Increasing Java Heap Size does nothing.
Groovy version is 1.7.

I read that this Exception can be caused by using groovydoc, bo none
of scripts is using it.

Regards,
Bartek

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email


Jochen Theodorou

unread,
Oct 2, 2012, 4:49:52 AM10/2/12
to us...@groovy.codehaus.org
Am 02.10.2012 10:42, schrieb Bartosz:
> While compiling groovy scripts using
> org.codehaus.groovy.ant.Groovyc.execute(...) method I'm getting
> following exception:
>
> [exec] Exception in thread "main" java.lang.OutOfMemoryError:
> Java heap space
[...]
> Increasing Java Heap Size does nothing.
> Groovy version is 1.7.

How and to what value did you increase the heap size?

bye blackdrag

--
Jochen "blackdrag" Theodorou - Groovy Project Tech Lead
blog: http://blackdragsview.blogspot.com/
german groovy discussion newsgroup: de.comp.lang.misc
For Groovy programming sources visit http://groovy-lang.org

Bartosz

unread,
Oct 2, 2012, 4:52:25 AM10/2/12
to us...@groovy.codehaus.org
I've increased heap size to 1GB.

Regards,
Bartek

2012/10/2 Jochen Theodorou <blac...@gmx.org>:

Jochen Theodorou

unread,
Oct 2, 2012, 5:56:53 AM10/2/12
to us...@groovy.codehaus.org
Am 02.10.2012 10:52, schrieb Bartosz:
> I've increased heap size to 1GB.

I mean if you just increased the heap ant gets and the task is a forked
one, then it won't help at all. You are using it from ant, or not?

Bartosz

unread,
Oct 2, 2012, 6:02:37 AM10/2/12
to us...@groovy.codehaus.org
No, it's hardcoded. I've increased heap size for Java App that is
invoking org.codehaus.groovy.ant.Groovyc.execute(...) method.

2012/10/2 Jochen Theodorou <blac...@gmx.org>:

Bartosz

unread,
Oct 2, 2012, 6:04:15 AM10/2/12
to us...@groovy.codehaus.org
Oh, I've already seen that there are methods like
groovyCompiler.setMemoryInitialSize("128m");
groovyCompiler.setMemoryMaximumSize("256m");
I'll try it form a moment.

2012/10/2 Bartosz <barto...@gmail.com>:

Bartosz

unread,
Oct 8, 2012, 6:38:20 AM10/8/12
to us...@groovy.codehaus.org
Actually, setting following options did nothing:
groovyCompiler.setMemoryInitialSize("512m");
groovyCompiler.setMemoryMaximumSize("1024m");

Any idea?

2012/10/2 Bartosz <barto...@gmail.com>:

Bartosz

unread,
Oct 15, 2012, 12:37:35 PM10/15/12
to us...@groovy.codehaus.org
Problem solved. I had to increase heap size for app (-Xmx -Xms).

2012/10/8 Bartosz <barto...@gmail.com>:
Reply all
Reply to author
Forward
0 new messages