Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AFU runs out of Java heap space when processing a large number of unrelated Java source files #99

Open
jthaine opened this issue Aug 6, 2015 · 2 comments
Milestone

Comments

@jthaine
Copy link
Contributor

jthaine commented Aug 6, 2015

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:

  1. Copy /www/secs-jenkins/bug_repros/afu/lotsofjavafiles.zip from tern.cs.washington.edu to your local machine.
  2. Unzip the file.
  3. 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.

@dbrosoft
Copy link
Contributor

It appears that the shared name table in the system Java compiler, which gets retrieved from the javac API and invoked (parse task and analyze task) once for each source file, is not getting reset in between files. Since invocation with thousands of files may be an uncommon mode of use, and since the problem can be worked around simply by invoking the program multiple times with subsets of the input, I have marked this issue as low priority.

@dbrosoft dbrosoft reopened this Aug 28, 2015
@dbrosoft
Copy link
Contributor

(Oops, wrong button!)

@mernst mernst added this to the Low milestone Jan 10, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants