Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Running out of memory in pipelines - tests pass locally w/ 8gb ram laptop

locally on a laptop with 8gb ram and a 2 core CPU, the tests pass easily.

however the tests fail on bitbucket due to out of memory. Error message is:


"Container 'Build' exceeded memory limit."

1 answer

0 votes

Hi @Christopher Klapperich,

Each step in a Pipelines build has 4 GB of memory available, unless you configure size: 2x, then the step will have 8 GB of memory available.

The build container is given 1024 MB of the total memory. If you are using services in a certain step, then each one gets 1024 MB memory by default, unless you have configured service memory differently in your yaml file.

If you subtract the above from the total memory of the step, you'll get the memory available for the build to run.

Could you give us some more details about this build, e.g. are you using any services in the step that fails? And are you using the size: 2x flag in that step?

You can try adding the following commands at the beginning of the script of the step that fails:

- while true; do ps -aux && sleep 30; done &
- while true; do echo "Memory usage in megabytes:" && echo $((`cat /sys/fs/cgroup/memory/memory.memsw.usage_in_bytes | awk '{print $1}'`/1048576)) && sleep 0.1; done &

These will print memory usage during the build which can be useful for understanding what processes use a lot of memory.

You can also try debugging this locally with Docker, so that you don't consume more build minutes trying to debug this:

There is an example in the above documentation, which how you can set the memory limit when debugging locally to replicate Pipelines as closely as possible (you can set either 4 GB or 8 GB if the step has size: 2x).

Please feel free to let me know if you have any questions.

Kind regards,

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Bitbucket

📣 Calling Bitbucket Data Center customers to participate in research

Hi everyone, Are you Bitbucket DC customer? If so, we'd love to talk to you! Our team wants to dive deep to understand your long-term plans regarding Bitbucket DC and Atlassian Cloud. Do you plan...

157 views 2 4
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you