Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to give a pipeline more memory, and what is the default?

SH
Contributor
March 31, 2025

If we run it the pipeline (see below), we get:

       java.lang.OutOfMemoryError: Java heap space

If we increase heap, e.g. by setting SONAR_SCANNER_JAVA_OPTS to -Xmx4096m, we get:

      Container 'Build' exceeded memory limit.

1. How much memory is allocated to the pipeline?

2. How do we increase it?  Some posts suggest adding "size: 4x" or similar but what is this 4x of, and where should we put it?

 

image: maven:3-jdk-11

clone:
depth: full # SonarQube Cloud scanner needs the full history to assign issues properly

definitions:
caches:
sonar: ~/.sonar/cache # Caching SonarQube Cloud artifacts will speed up your build
steps:
- step: &build-test-sonarcloud
name: Build, test and analyze on SonarQube Cloud
caches:
- maven
- sonar
script:
- mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar
artifacts:
- target/**

pipelines: # More info here: https://confluence.atlassian.com/bitbucket/configure-bitbucket-pipelines-yml-792298910.html
branches:
develop:
- step: *build-test-sonarcloud
pull-requests:
'**':
- step: *build-test-sonarcloud

 

 

size: 8x

1 answer

1 accepted

3 votes
Answer accepted
John Emmanuel
Contributor
March 31, 2025

Hi,

You can refer to this article for information about step sizes: https://support.atlassian.com/bitbucket-cloud/docs/step-options/#Size

Bitbucket assigns 4GB per step container (1x) steps. I would recommend trying 2x steps, which would give 8GB of memory to your step container, and then increase the sonarqube heap memory to 4 GB.

  steps:
- step: &build-test-sonarcloud
name: Build, test and analyze on SonarQube Cloud
size: 2x

 I have used Sonar Scanner Docker images for the pipeline. To achieve this, I had to increase the step size to 2x and then increase the Docker memory limits from 1024 to 4096.

Note: 2x builds use 2x minutes off your monthly build minutes.

SH
Contributor
April 2, 2025

Thanks, adding 2x worked.  The issue for us is that we did not know what it was 2x of.  Now we know its 4GB, so 2x is 8GB.  

Like John Emmanuel likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events