Question: SBT out of memory with subprojects

Question

SBT out of memory with subprojects

Answers 0
Added at 2016-12-28 10:12
Tags
Question

We're using SBT 0.13 on CircleCI to build a Play application with several subprojects. We were occasionally getting out of memory issues on CircleCI, where it aborted our build because it exceeded 4 GB of memory usage.

Yesterday, I added a new subproject to our build, and almost all builds fail now on the out of memory issue. It looks like adding subprojects also adds to the amount of memory used for our build.

I've tried several things to reduce our memory load:

  • Add _JAVA_OPTIONS: "-Xms512m -Xmx2048" to circle.yml as described on CircleCI's documentation pages. (I noticed from the log that the JVM does pick up on this setting.)
  • Add a -mem parameter to the SBT call.
  • Add concurrentRestrictions in Global += Tags.limit(Tags.Test, 1) to the top of the SBT file, to make sure that at least the memory isn't used all at once.

All of these measures seemed to have helped, but I haven't found the definitive solution to this problem yet.

What else can I do to keep SBT's memory usage under control?

EDIT: Our project has 5 subprojects, with about 14000 lines of Scala code (and also, 21000 lines of Java code that we 'inherited'). The out-of-memory usually (but not always) occurs while executing static analysis using FindBugs: we use that in conjunction with the FindSecurityBugs plugin to find security issues.

Answers
Source Show
◀ Wstecz