Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6977131
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:35:10+00:00 2026-05-27T17:35:10+00:00

I am using Jenkins to run some system tests. Those tests write 18-20 MB

  • 0

I am using Jenkins to run some system tests.
Those tests write 18-20 MB printouts to the standard output.
Jenkins job is configured to run with 2048 MB max heap size.
Strangely enough, when these printouts are turned on, jenkins goes OutOfMemoryError (out of heap space).

It is definitely the printouts which cause the problem. Without them, all works fine.
What troubles me, how 20 MB of text cause the whole process to be OutOfMemory.

I already have increased the heap size from 1 GB to 2 GB, but without any result.
Without the prints, on 1GB max heap size all tests work fine.

Here the exception:

java.lang.OutOfMemoryError: Java heap space
    at java.util.Arrays.copyOf(Arrays.java:2786)
    at java.io.ByteArrayOutputStream.write(ByteArrayOutputStream.java:94)
    at java.io.PrintStream.write(PrintStream.java:430)
    at org.apache.maven.surefire.util.TeeStream.write(TeeStream.java:44)
    at java.io.PrintStream.write(PrintStream.java:430)
    at org.apache.maven.surefire.util.TeeStream.write(TeeStream.java:42)
    at java.io.PrintStream.write(PrintStream.java:430)
    at org.apache.maven.surefire.util.TeeStream.write(TeeStream.java:42)
    at java.io.PrintStream.write(PrintStream.java:430)
    at org.apache.maven.surefire.util.TeeStream.write(TeeStream.java:42)
    at java.io.PrintStream.write(PrintStream.java:430)
    at org.apache.maven.surefire.util.TeeStream.write(TeeStream.java:42)
    at java.io.PrintStream.write(PrintStream.java:430)
    at org.apache.maven.surefire.util.TeeStream.write(TeeStream.java:42)
    at java.io.PrintStream.write(PrintStream.java:430)
    at org.apache.maven.surefire.util.TeeStream.write(TeeStream.java:42)
    at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:202)
    at sun.nio.cs.StreamEncoder.implWrite(StreamEncoder.java:263)
    at sun.nio.cs.StreamEncoder.write(StreamEncoder.java:106)
    at java.io.OutputStreamWriter.write(OutputStreamWriter.java:190)
    at java.io.BufferedWriter.flushBuffer(BufferedWriter.java:111)
    at java.io.PrintStream.write(PrintStream.java:476)
    at java.io.PrintStream.print(PrintStream.java:619)
    at java.io.PrintStream.println(PrintStream.java:756)
    ...

Does anyone know some sort of configuration of Jenkins, that a lot of prints to the System.out (20 MB of them) won’t cause the OutOfMemory to occur?

Clarification: I don’t want to debug Jenkins, I am not a Jenkins developer. I use Jenkins to run system tests using JUnit on my application as CI.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T17:35:11+00:00Added an answer on May 27, 2026 at 5:35 pm

    Try starting jenkins with “-XX:+HeapDumpOnOutOfMemoryError” JVM argument, that should give you a dump file to analyze whenever you get the out of memory exception.

    EDIT —

    I think I may have something for you.
    First of, the surefire plugin by default forks a new JVM for running tests, and this JVM does not inherit JVM properties of the maven JVM, i.e. if you’ve set the maven process to have 2048MB Max Heap, it will not be set for the JVM forked by the surefire plugin.
    So for setting JVM args of the forked JVM, use the ‘argLine’ property of the surefire plugin. That way you’ll be able to set the Max heap for the forked JVM and not the maven JVM.

    Secondly, It looks like the surefire plugin redirects the stdout/stderr and keeps the contents of stuff written to these 2 streams in memory, that’s why you may be running out of memory.
    So you can also try setting ‘redirectTestOutputToFile’ property to ‘true’, that way all sdtout goes to a file, may be that will avoid storing the stream contents in memory,
    Or try setting the forkmode=’always’, that way it will fork one JVM per test-class, keeping the memory consumption from piling up, one test after another.

    Hope one of these helps you in your issue.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I use Jenkins to run some integration tests on a web appilcation (using cucumber,
I am using Jenkins to run a simple script which displays output on the
Using C# .NET 3.5 and WCF, I'm trying to write out some of the
We are using the Play! framework and I've setup our Jenkins CI to run
I'm using the Play! WebDrive Module and the jobs run okay but when tests
I am currently performing unit tests on my code (using PHPUnit and Jenkins) but
I am using Jenkins for running Selenium tests in a monitoring way. The failures
I'm just getting started using GitHub, Gerrit, and Hudson(Jenkins) together. And I need some
Using online interfaces to a version control system is a nice way to have
Using PyObjC , you can use Python to write Cocoa applications for OS X.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.