I am getting a VM error while trying to generate the report. This happens with one out of 500 .ec data files at random.
[EMMA v2.0, build 5312]
emma report: unexpected failure:
Exception in thread "main" com.vladium.emma.EMMARuntimeException: unexpected failure:
at com.vladium.emma.Command.exit(Command.java:237)
at com.vladium.emma.report.reportCommand.run(reportCommand.java:145)
at emma.main(emma.java:40)
Caused by: java.lang.OutOfMemoryError: Requested array size exceeds VM limit
Here is the command which I am running:
$JAVA_HOME/bin/java -Xmx2048m -classpath emma.jar emma report -verbose -r html -sourcepath /tmp/source -in emma_data/test1_1_coverage.em,emma_data/test1_0_coverage.ec,emma_data/test1_2_coverage.ec
Stack trace while running with java 6.0:
[EMMA v2.0, build 5312]
emma report: unexpected failure:
Exception in thread "main" com.vladium.emma.EMMARuntimeException: unexpected failure:
at com.vladium.emma.Command.exit(Command.java:237)
at com.vladium.emma.report.reportCommand.run(reportCommand.java:145)
at emma.main(emma.java:40)
Caused by: java.lang.OutOfMemoryError: Java heap space
at java.util.HashMap.<init>(HashMap.java:187)
at java.util.HashMap.<init>(HashMap.java:199)
at com.vladium.emma.data.MetaData.readExternal(MetaData.java:223)
at com.vladium.emma.data.DataFactory.readEntry(DataFactory.java:770)
at com.vladium.emma.data.DataFactory.mergeload(DataFactory.java:461)
at com.vladium.emma.data.DataFactory.load(DataFactory.java:56)
at com.vladium.emma.report.ReportProcessor._run(ReportProcessor.java:175)
at com.vladium.emma.Processor.run(Processor.java:54)
at com.vladium.emma.report.reportCommand.run(reportCommand.java:130)
Logged In: YES
user_id=1118589
Originator: YES
I did some more R&D on this problem. I ran into a problem with the functioning of DataFactory class. Here is what I found:
1. When DataFactory class is processing the .ec file, the line
final byte type = raf.readByte ();
is always returning type=1, since the code is processing a coverage data file.
2. In between at some point, raf.readByte() returns 0 instead of 1 and the code switches to process metadata file since type=0 indicates a metadata file.
3. Therafter, Metadata.readExternal(din) takes over and din.readInt() returns a very huge number which is well beyond the VM settings. When the code tries to initialize a HashMap with that huge number, it throws an out of memory error.
I am not sure why the type value switches to "0" during the coverage data file processing.