Hacker News new | ask | show | jobs
by e12e 2903 days ago
> Rustc memory usage on Linux is also high, but it never runs out of memory. I would like to figure out the cause of this issue.

Strange. I hope this isn't simply a case of wildly over-committing memory and getting away with it on Linux. But then I guess the bsd folks would have is yes too?

1 comments

I believe it is a result of changes described here (the post is about thinLTO but it explains parallel codegen after the TOML config example): https://internals.rust-lang.org/t/help-test-out-thinlto/6017

In order to parallelize the build process at the rustc-llvm codegen boundary, Cargo has to implement some orchestration between compiler processes (using jobserver-rs [1]) so that 10 rustc processes didn't all create 10 threads and codegen units each and blow up the system. I'm guessing that memory quotas are a part of that implementation.

[1] https://crates.io/crates/jobserver/reverse_dependencies