OutOfMemoryError when running JUnit tests with many console println()-s

When running JUnit test which produces many EOLs in its output, Gradle gets OutOfMemoryError.

The example is here: https://github.com/mbutov/gradle-oom.

In this example:

  • Maximum heap size for tests: 128m
  • Total size of test output: 728k
  • Gradle version: 2.11

Thanks, which version of Java are you using?

Gradle 2.10 - 2.11, Oracle Jdk 1.8.0_31-b13 x64, Ubuntu 14.04

This change might help a bit with memory consumption, however I haven’t yet checked if it helps with the case you presented. https://github.com/gradle/gradle/commit/1746300a , that was made as a fix for https://issues.gradle.org/browse/GRADLE-3329