GitHub Actions running out of memory

Published on August 27, 2025 | Written by Andreas

Is your GitHub Actions job failing with a cryptic error message? If you’ve seen your build crash unexpectedly, it might not be a problem with your code but with the environment it’s running in. The GitHub-hosted runners that power your workflows have finite memory—typically 7 GB for private repositories. For many modern build processes, that’s simply not enough.

Out-of-memory issues are a common and frustrating cause for build failures on GitHub Actions.

GitHub Actions running out of memory

Problem

If your build log contains error messages like the ones below, memory is the likely culprit. The most telling sign is exit code 137, which indicates the operating system forcefully terminated your process (SIGKILL) to prevent system instability.

JavaScript heap out of memory
Java.lang.OutOfMemoryError: Java heap space
Couldn't allocate enough memory
Error: The process '/usr/bin/python3' failed with exit code 137
Killed process
runtime: out of memory: cannot allocate 16384-byte block

The standard GitHub-hosted runners are powerful, but their resources are limited. As you can see in the table below, runners for private repositories get less than half the RAM of those for public ones on Linux and Windows, which can cause builds that pass in public forks to fail in your private environment.

OSPrivate RepositoryPublic Repository
Linux7 GB16 GB
Windows7 GB16 GB
macOS (Intel)14 GB14 GB
macOS (M1)7 GB7 GB

This memory constraint makes it common for jobs to fail, especially complex builds in private repositories.

Solution

So, how do you give your GitHub Actions jobs more memory? Let’s explore two effective solutions.

First, use large runners provided by GitHub.

  • Requires a GitHub Team or GitHub Enterprise Cloud plan.
  • Large runners provide up to 384 GB memory.
  • GitHub charges about $0.001 per GB memory and minute.

The following table shows an excerpt of large runner pricing.

OSCPU coresMemory$/min
Linux28 GB$0.008
Linux416 GB$0.016
Linux832 GB$0.032
Linux1664 GB$0.064
Linux32128 GB$0.128
Linux64256 GB$0.256
Linux96384 GB$0.384

While powerful, the cost of large runners can add up quickly, which leads us to a more flexible and cost-effective alternative.

Second, use HyperEnv to deploy self-hosted GitHub Actions runners on AWS with ease. Doing so allows you to choose from a variety of virtual machines with up to 768 GB memory.

HyperEnv consists of the following building blocks as illustrated in the following figure.

  • API Gateway
  • Lambda function
  • Step Functions state machine
  • Lambda function
  • EC2 instances

The HyperEnv architecture consists of API Gateway, Lambda, Step Functions, and EC2

The solution is easy to install and requires minimal maintenance. Get started in four simple steps.

  1. Create AWS Marketplace subscription
  2. Launch with CloudFormation
  3. Install GitHub app
  4. Modify GitHub workflow to switch from GitHub-hosted to HyperEnv runner

Deploy HyperEnv in 10 minutes!

Self-hosting GitHub runners on AWS has never been easier.

Deploy in 10 min Book a demo