I'm running into some problems because the rustc build of one of my crates (https://github.com/samuela/rustybox) requires ~7GB of memory. Why in the world does rustc require so much memory? Are there any particular rust features that lead to this kind of outsized memory usage?
Would "crate shattering" the project into multiple crates help? In this particular case, I'm okay with doing that if it solves the problem, but it hardly seems like it should even be necessary in the first place.
Here's how I benchmarked it:
$ /usr/bin/time -v cargo build --jobs 1 ... Finished dev [unoptimized + debuginfo] target(s) in 3m 17s Command being timed: "cargo build --jobs 1" User time (seconds): 156.60 System time (seconds): 17.12 Percent of CPU this job got: 87% Elapsed (wall clock) time (h:mm:ss or m:ss): 3:17.98 Average shared text size (kbytes): 0 Average unshared data size (kbytes): 0 Average stack size (kbytes): 0 Average total size (kbytes): 0 Maximum resident set size (kbytes): 7053216 Average resident set size (kbytes): 0 Major (requiring I/O) page faults: 27 Minor (reclaiming a frame) page faults: 768571 Voluntary context switches: 38426 Involuntary context switches: 304785 Swaps: 0 File system inputs: 334648 File system outputs: 632816 Socket messages sent: 0 Socket messages received: 0 Signals delivered: 0 Page size (bytes): 4096 Exit status: 0