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 to false), 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 and memoryMaximumSize attributes of the javac 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.