cargo test renders device unresponsive due to MSVC linker RAM usage #12916
Labels
A-doctests
Area: rustdoc --test
C-bug
Category: bug
S-needs-design
Status: Needs someone to work further on the design for the feature or fix. NOT YET accepted.
Problem
Invoking
cargo t
on an i7-13700K Win11 with 32GB RAM makes the whole device unresponsive.CPU is around 20-30%, RAM climbs at 100% and is likely paging heavily, process explorer shows 1 instance of the MSVC linker (link.exe) per core (24), each consuming 1+ GB of RAM.
Steps
cargo t
on Windows 11 (not sure version matters; use of MSVC is required though)Possible Solution(s)
link.exe
instance). This is likely not ideal because RAM footprint probably depends on crate(s) linked. In the example used (Bevy) the project is very large (300+ packages), so the linker very busy.Cargo.toml
(Enable specifying --test-threads in Cargo.toml #8430)Notes
Confirmed that
cargo t -- --test-threads=8
yields a lot smoother experience, as RAM usage never goes above 60% and therefore CPU usage is much higher (almost CPU bound).This affects only doc tests, not regular tests (which don't link I guess). Solution ideally shouldn't limit the number of parallel tests for regular tests, only limit parallel linker instances / doc tests.
Somewhat related to #8430 but for different reason.
Version
The text was updated successfully, but these errors were encountered: