2

My Jenkins is running in an Ubuntu server instance. At the completion, when a Checkmarx report is being generated, I get a Java heap space issue as shown in the screen shot:

Jenkinks java heap space Error

Can someone help me how to increase Java heap space in Checkmarx?

To read the Atlassian KB article "Scan Fails with Java Heap Space Exception" an account seems to be necessary.

U880D
  • 8,601
  • 6
  • 24
  • 40
Niranga Sandaruwan
  • 691
  • 2
  • 19
  • 39
  • 1
    java.lang.OutOfMemoryError: Heap space means that you need to increase the amount of heap space allocated to Jenkins.To add more Java heap space, increase the value of the -Xmx Java parameter Try setting this parameter to 1 GB (1048MB) and restart jenkins – Manish Sahni Jul 24 '17 at 04:21
  • https://wiki.jenkins.io/display/JENKINS/Builds+failing+with+OutOfMemoryErrors – Yuri G. Jul 24 '17 at 04:41

1 Answers1

6

Read more about what is OutOfMemoryError here. Jenkins itself run as a Java process and if your Jenkins job is also a java process, both of them could cause out of memory Error.

By seeing the log it looks like your job is running into the error. So read also about How to set a JVM option in Jenkins globally for every job?.

Edit: If your Jenkins process itself running into OutOfMemoryError, then refer to Increase heap size in Java on how to increase the JVM heap size for Java processes.

Normally -Xmx2048M is used to specify the max heap size for a java process, in my example i am setting it to 2048 MB. Depending on your configuration, you specify this value in different ways.

Amit
  • 30,756
  • 6
  • 57
  • 88
  • I wanted to handle this error in checkmarx side.I found this post https://checkmarx.atlassian.net/wiki/display/KC/Scan+Fails+with+Java+Heap+Space+Exception# – Niranga Sandaruwan Jul 24 '17 at 05:55
  • 1
    @NirangaSandaruwan , cool basically as i pointed out if its ultimately happening because java process doesn't have enough memory. as in your case you are scanning log files, which is a memory intensive operation as it will create try to create a buffer in memory. – Amit Jul 24 '17 at 08:43
  • @NirangaSandaruwan That's a dead link. Do you have an updated link that works? – Paradox Jun 09 '23 at 13:19