Skip to content
Latchkey

g++/clang "internal compiler error: Killed" (OOM)

An "internal compiler error: Killed" with (program cc1plus) is almost never a compiler bug. The OOM killer terminated the compiler because a single translation unit (or many parallel ones) exceeded the runner RAM.

What this error means

A C/C++ build fails with internal compiler error: Killed (program cc1plus) or cc1. Lowering -j or using a larger runner clears it with no source change.

shell
g++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report...
make[1]: *** [foo.o] Error 4

Common causes

Too many parallel compiler processes

A high -j value runs many cc1plus instances at once; combined memory use exceeds the runner and the OOM killer fires.

One heavy translation unit

Template-heavy or generated source can make a single compile spike past available RAM.

How to fix it

Lower compile parallelism

Fewer parallel jobs cuts peak memory dramatically.

shell
make -j2          # instead of -j$(nproc)
# or for cmake/ninja
cmake --build . -j 2

Add memory or reduce per-unit cost

  1. Run the build on a runner with more RAM.
  2. Split or simplify the heaviest translation units.
  3. Use precompiled headers to cut per-file memory.

How to prevent it

  • Tune -j to the runner RAM, not just cores.
  • Right-size memory for C++ builds.
  • Watch peak memory during compiles.

Frequently asked questions

What causes "ICE: Killed (OOM)"?
A high -j value runs many cc1plus instances at once; combined memory use exceeds the runner and the OOM killer fires.
How do I fix ICE: Killed (OOM)?
Fewer parallel jobs cuts peak memory dramatically.
Can Latchkey fix this automatically?
Yes. Latchkey runs your GitHub Actions on managed runners that detect this failure, apply the fix, and retry the job automatically - self-healing is on by default.

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card