Error

"out of memory" During Compilation — How to Fix

Fix Rust out of memory errors during compilation by disabling debug info or limiting parallel build jobs.

Increase the memory available to the Rust compiler by setting the RUSTFLAGS environment variable to disable debug info or limit parallel jobs.

export RUSTFLAGS="-C debuginfo=0"
cargo build

Alternatively, limit parallel compilation jobs to reduce peak memory usage:

export RUSTFLAGS="-C debuginfo=0"
export CARGO_BUILD_JOBS=1
cargo build