Why do I get an java.lang.OutOfMemoryError when compiling with Clover turned on?
Q: Why do I get an java.lang.OutOfMemoryError when compiling with Clover turned on?
A: Instrumenting with Clover increases the amount of memory that the compiler requires in order to compile.To solve this problem, you need to give the compiler more memory. Increasing the memory available to the compiler depends on how you are launching the compiler:
- If you are using the "in-process" compiler (the
<javac>
task with the"fork"
attribute set tofalse
), you will need to give Ant itself more memory to play with. To do this, use the ANT_OPTS environment variable to set the heap size of the JVM used to run Ant:
export ANT_OPTS=-Xmx256m
- If you are using an external compiler (the <javac> task with the "fork" attribute set to true), you can set the
memoryInitialSize
andmemoryMaximumSize
attributes of thejavac
task:
<javac srcdir="${src}"
destdir="${build}"
fork="true"
memoryInitialSize="128m"
memoryMaximumSize="256m"/>
- If you are using Intellij, increase the Maximum heap size on the Java Compiler.
Screenshot: Adjusting Heap Size in IntelliJ IDEA
最終更新日 2009 年 4 月 22 日
Powered by Confluence and Scroll Viewport.