Skip to content
Latchkey

How to Use size 2x for More Memory in Bitbucket Pipelines

The size: key doubles (2x) or quadruples (4x) a step memory allocation for builds that exhaust the default budget.

Set size: 2x on a step to raise its memory. Remember the budget is shared between your build container and any attached services or docker daemon.

A larger step with a service

size: 2x raises the memory so the build and Postgres service both fit.

bitbucket-pipelines.yml
pipelines:
  default:
    - step:
        name: Heavy build
        size: 2x
        services:
          - postgres
        script:
          - npm ci && npm run build:all

Gotchas

  • The step memory budget is shared with services and the docker daemon - bump size when you add them.
  • Larger sizes consume more build minutes per minute of wall-clock time.
  • If a step is killed without a clear error, an out-of-memory kill is a likely cause - try 2x.

Related guides

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