Skip to content

build: cap engine compile jobs by available RAM - #1

Merged
ralyodio merged 2 commits into
mainfrom
fix/build-jobs-mem-cap
Nov 30, 2026
Merged

ralyodio merged 2 commits into
mainfrom
fix/build-jobs-mem-cap

Conversation

@ralyodio

Copy link
Copy Markdown
Contributor

cargo build --release failed on a 32-core box with c++: fatal error: Terminated signal terminated program cc1plus: build.rs passed cargo's NUM_JOBS (32) to cmake --build --parallel.

The SIGTERM comes from earlyoom (-m 6,3 -s 100,100 --prefer ...cc1plus...), not the kernel: once MemAvailable drops under 6% with swap full, it kills cc1plus first. Each cc1plus is only ~350 MB, but on a shared box other services spike; 8 jobs still got killed.

  • Default engine jobs = min(NUM_JOBS, MemAvailable / 4 GB, 4), at least 1. Prints the chosen count as a cargo warning.
  • SK33P_JOBS still overrides. README updated.

Verified: clean cargo build --release on the same box picks 4 jobs and finishes in 43s with no kills (32 and 8 jobs both failed).

🤖 Generated with Claude Code

ralyodio and others added 2 commits November 30, 2026 14:23
Cargo's NUM_JOBS is the CPU count (32 here); 32 concurrent cc1plus on the
engine sources OOM-kills the compiler ("Terminated signal terminated
program cc1plus"). Default to one job per 2 GB of MemAvailable, capped at
NUM_JOBS; SK33P_JOBS still overrides.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
8 jobs still tripped earlyoom on a shared box (each cc1plus is ~350 MB,
but other services spike). 4 jobs builds clean in 43s.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ralyodio
ralyodio merged commit e441379 into main Nov 30, 2026
2 of 3 checks passed
@ralyodio
ralyodio deleted the fix/build-jobs-mem-cap branch November 30, 2026 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant