Skip to content

fix: prevent arm64 OOM during linking with lld + job limit#5

Merged
zeekay merged 3 commits intomainfrom
fix/arm64-oom-linker
Mar 3, 2026
Merged

fix: prevent arm64 OOM during linking with lld + job limit#5
zeekay merged 3 commits intomainfrom
fix/arm64-oom-linker

Conversation

@zeekay
Copy link
Member

@zeekay zeekay commented Mar 3, 2026

Summary

  • Configure lld as the linker for Linux targets in .cargo/config.toml — lld uses ~3x less memory than the default ld linker, which is critical for the arm64 Graviton runner (c7g.2xlarge, 16GB RAM)
  • Add clang to apt-get install (required as the linker driver for -fuse-ld=lld)
  • Set CARGO_BUILD_JOBS=4 in both Dockerfiles to cap parallel compilation and further reduce peak memory

Root cause

The arm64 Docker build OOMs during the final link step (collect2: fatal error: ld terminated with signal 9 [Killed]). The default GNU ld linker loads all object files into memory at once and on arm64 with hundreds of crates this exceeds 16GB. The amd64 build succeeds because the DOKS runner pod has more available memory.

Changes

File Change
.cargo/config.toml Add [target.x86_64-unknown-linux-gnu] and [target.aarch64-unknown-linux-gnu] sections using clang+lld
docker/Dockerfile Add clang to build deps, add ENV CARGO_BUILD_JOBS=4
.github/Dockerfile Add clang to build deps, add ENV CARGO_BUILD_JOBS=4

Test plan

  • arm64 Docker build completes without OOM
  • amd64 Docker build still succeeds (lld is faster there too)
  • CI test image builds on both architectures

@zeekay zeekay merged commit 3500ce4 into main Mar 3, 2026
3 checks passed
@zeekay zeekay had a problem deploying to FROM_WALLET_PRIVATE_KEY March 3, 2026 15:11 — with GitHub Actions Failure
@zeekay zeekay had a problem deploying to FROM_WALLET_PRIVATE_KEY March 3, 2026 15:11 — with GitHub Actions Error
@zeekay zeekay had a problem deploying to FROM_WALLET_PRIVATE_KEY March 3, 2026 15:11 — with GitHub Actions Error
@zeekay zeekay had a problem deploying to FROM_WALLET_PRIVATE_KEY March 3, 2026 15:11 — with GitHub Actions Failure
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