Unable to generate HTML reports due to java.lang.OutOfMemoryError

Still need help?

The Atlassian Community is here for you.

Ask the community

Symptoms

Able to instrument code correctly, run tests, and generate clover DB files and clover XML. When running HTML report generation, however, you get the following error:


BUILD FAILED
java.lang.OutOfMemoryError: Java heap space

Cause

Clover requires more memory in order to create the html reports.

Resolution

Try increasing the memory available to clover. For example up to -Xmx1024m.

To increase for Ant, you need to set it in your ANT_OPTS environment variable. E.g.


export ANT_OPTS="-Xmx1024m -Xms256m"

Similarly for Maven, you need to set it in your MAVEN_OPTS environment variable. E.g.


export MAVEN_OPTS="-Xmx1024m -Xms256m"

If that still gives you out of memory, increase to -Xmx2048m and set your Clover report to single-threaded mode please (set numThreads="0"). See clover-html-report.

This is normally one way to limit memory usage for large projects but at the slight cost of report generation time. If numThreads="0" works you could then try numThreads="1" (default is 2).

If that still gives you out of memory, decrease the coverage cache size (set coverageCacheSize="128m" or "64m" or even "32m"). See clover-html-report.

If that fails, or if report generation succeeds but takes a long time your project's size may be pushing Clover's current abilities to generate a report with the confines of a 32bit JVM's maximum heap size (2048m on *nix & OSX, 1546m on Windows). Please consider using a 64bit JVM with a higher heap size.

If it still fails, then please create a support case at http://support.atlassian.com and:

1) Let us know how big is your project (num files, num non-comment lines of code etc).
2) Rerun with the "-XX:+HeapDumpOnOutOfMemoryError" java parameter so that a *.hprof is created when you hit a out of memory error. (The *.hprof file should be approximately equal to the memory you allocated, i.e. for -Xmx2048m it should be around 2G big).
3) Attach the heap dump as well as the output of trying to create the report to the support case. (If the zip of the hprof file is to big to attach to the case, then let us know in the support case and we will setup a location for you to upload to).

Last modified on Nov 21, 2012

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.