Temporary Swap File Fixes gcc Build Failures Caused by Out-of-Memory Kills
A developer building software on a small VPS or CI runner found gcc failing mid-build with a 'Killed (program cc1)' error. The failure stems from the Linux OOM killer terminating the memory-hungry cc1 compiler process when system RAM runs low. The article recommends adding a temporary swap file, which can be created, enabled for the build, and removed afterward without editing fstab or rebooting. It notes that this approach suits occasional builds on constrained machines but is slow and inappropriate for production systems facing chronic memory shortages. The author stresses it is a stopgap, advising more RAM or leaner build strategies for recurring problems.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in