build: Rust parallelism can drown low spec devices
Hey,
This is to record that currently, Rust-based builds do not have any sort of parallelism limit. This means, for instance, that when compiling gst-plugins-rs
for cross-ios-universal
, the last job will have at the very least 2x the number of threads competing for CPU time.
When I tried this on my Macbook Retina early 2015 (Haswell, 8GB RAM, 4 threads), I had 2 * 4 * 2 jobs in RAM. This caused a total swapping of 1 TB until the build finished (would have probably been more had I not been able to kill -STOP
the Rust jobs midway).
A possible fix would be to set NUM_JOBS
to 1 in the environment of Cargo jobs, so that all downstream consumers won't exceed a single core.