I have a QuickBuild server (5.0.14). This is running a build step using ant.
The Ant target looks like this:
<target name="clover-snapshot" depends="with-clover">
<clover-snapshot file="${clover.snapshot.file}"/>
</target>
We are using Clover Version 3.1.5.
This step is failing with the following stacktrace:-
java.lang.OutOfMemoryError: Java heap space
at com.cenqua.clover.util.CloverBitSet.read(CloverBitSet.java:71)
at com.cenqua.clover.PerTestRecordingTranscript.read(PerTestRecordingTranscript.java:45)
at com.cenqua.clover.RecordingTranscripts.readSliceFromDisk(RecordingTranscripts.java:124)
at com.cenqua.clover.RecordingTranscripts$FileRef.read(RecordingTranscripts.java:354)
at com.cenqua.clover.CoverageDataCollator.collatePerTestRecordings(CoverageDataCollator.java:156)
at com.cenqua.clover.CoverageDataCollator.loadCoverageData(CoverageDataCollator.java:68)
at com.cenqua.clover.CloverDatabase.loadCoverageData(CloverDatabase.java:164)
at com.cenqua.clover.CloverDatabase.loadCoverageData(CloverDatabase.java:159)
at com.cenqua.clover.CloverDatabase.loadWithCoverage(CloverDatabase.java:283)
at com.cenqua.clover.tasks.CloverSnapshotTask.cloverExecute(CloverSnapshotTask.java:51)
at com.cenqua.clover.tasks.AbstractCloverTask.execute(AbstractCloverTask.java:55)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
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:392)
at org.apache.tools.ant.Target.performTasks(Target.java:413)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
at org.apache.tools.ant.Main.runBuild(Main.java:811)
at org.apache.tools.ant.Main.startAnt(Main.java:217)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
I take it from the call to invoke()
in the above that Clover is being called reflectively within the JVM used by Ant.
As such, I have attempted to allocate more heap space to the Ant JVM. I did this by editing the build step in QuickBuild and specifying the following environment variable:-
ANT_OPTS
is set to -Xmx1024m -Xms512m
This has not solved the issue. (I plucked these numbers out of the air, the max size was not calculated in any sort of way.)
My question is, how can I allocate additional heap space to Clover to allow it to execute without running out of memory. Or alternatively, what can I do to confirm these settings are being used?
It looks like you did everything correctly.
ANT_OPTS
is the right way to solve this problem. I've used pretty much the same approach to solve similar problem. Did you use 64-bit JVM? Did you see that space has been actually allocated?Anyway, there is a good instruction:
I would also suggest to use VisualVM in order to verify JVM has been created properly and identify the actual cause.