Given an input set of 1858 small (< 6 KB each) unrelated Java source files, on a Fedora VM with 8 GB of RAM, the AFU runs out of heap space when inserting annotations into source.
Repro steps:
- Copy /www/secs-jenkins/bug_repros/afu/lotsofjavafiles.zip from tern.cs.washington.edu to your local machine.
- Unzip the file.
- Run:
insert-annotations-to-source -v -i default.jaif @javafiles
Actual behavior: after processing ~1600 input files, the AFU slows down tremendously on the processing of each file, and ultimately fails with:
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOf(Arrays.java:2367)
at java.lang.AbstractStringBuilder.expandCapacity(AbstractStringBuilder.java:130)
at java.lang.AbstractStringBuilder.ensureCapacityInternal(AbstractStringBuilder.java:114)
at java.lang.AbstractStringBuilder.insert(AbstractStringBuilder.java:973)
at java.lang.StringBuilder.insert(StringBuilder.java:291)
at annotator.Source.insert(Source.java:151)
at annotator.Main.main(Main.java:971)
Expected: the AFU should not leak memory and thus should be able to process an unlimited number of unrelated Java source files without slowing down.