How to Increase Step Memory With size in Bitbucket Pipelines
The size key multiplies a step's memory allocation; 2x doubles the default, with larger sizes available on paid plans.
Add size: 2x to a step that runs out of memory. The default 1x gives 4 GB; 2x gives 8 GB, split between your script and any services.
Steps
- Confirm the step is failing on memory (for example an OOM exit code 137).
- Add
size: 2xto that step. - Budget memory across the step and its services within the new total.
bitbucket-pipelines.yml
bitbucket-pipelines.yml
pipelines:
default:
- step:
name: Heavy build
size: 2x
script:
- ./gradlew build --no-daemonGotchas
- A 2x step consumes build minutes at twice the rate of a 1x step.
- Sizes above 2x (4x, 8x) require self-hosted runners or specific plans.
Related guides
How to Use a Database Service in Bitbucket PipelinesAttach a Postgres or Redis service to a Bitbucket Pipelines step using the services key and definitions, so i…
How to Build and Push a Docker Image in Bitbucket PipelinesBuild a Docker image in Bitbucket Pipelines by enabling the docker service for a privileged daemon, then push…