Skip to content
Latchkey

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: 2x to 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-daemon

Gotchas

  • 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

Run this faster and cheaper on Latchkey managed runners. Start free →