Details
-
Bug
-
Status: Closed
-
Critical
-
Resolution: Duplicate
-
2.4.3
-
None
-
None
-
Linux,JDK 1.6.0.07, surefire 2.4.2
OSX, JSK 1.5/1.5, surefire 2.4.2, 2.4.3
Description
I have some unit tests that indirectly generate a lot of output to stdout/stderr. What I have been noticing on the build server is that a lot of these tests die with OutOfMemory errors.
After profiling the testcase locally, it seems the cause isn't my own code, but the Maven runtime.
Specifically, the org.apache.maven.surefire.report.ReporterManager class seems to like holding the entire output in RAM via the variables:
private ByteArrayOutputStream stdOut;
private ByteArrayOutputStream stdErr;
The actual contents of these seem to be disregarded unless the test is failed, at which point you need the entire string, again, in RAM.
I wanted to provide a patch for this but I couldn't find a nice one as the design is a big unfortunate: org.apache.maven.surefire.report.Reporter expects a String for stdout/stderr – perhaps a CharSequence would be nicer and we could have an adapter over a temporary file insted of a ByteArrayOutputStream.
Attachments
Issue Links
- duplicates
-
SUREFIRE-495 OutOfMemory Exception
- Closed