You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
cargo test renders device unresponsive due to MSVC linker RAM usage #12916
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.
Run cargo t on Windows 11 (not sure version matters; use of MSVC is required though)
Possible Solution(s)
Limit the number of threads used when cargo test runs rustdoc on Windows, due to the large RAM footprint of the MSVC linker (about 1 GB per test running / 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.
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.
Thanks @epage. I'd like to highlight that the pressure of non-doc tests has never been a problem with the mentioned projects as far as I know. Doctest ones though have started to be a consistent issue locally for several months, possibly more.
At least on Linux, the debug_pubtypes and debug_pubnames take the largest portion in a binary. Doc tests do suffer from this as well from my experience.
Activity
epage commentedon Nov 6, 2023
We're tracking CPU/memory pressure during compilation at #12912. doctests adds an interesting twist to this problem.
djeedai commentedon Nov 6, 2023
Thanks @epage. I'd like to highlight that the pressure of non-doc tests has never been a problem with the mentioned projects as far as I know. Doctest ones though have started to be a consistent issue locally for several months, possibly more.
weihanglo commentedon Nov 6, 2023
Specifically to linker RAM usage, they might be attributed to these issue:
.debug_pubnamesand.debug_pubtypesinto Linux object files and binaries rust#48762At least on Linux, the
debug_pubtypesanddebug_pubnamestake the largest portion in a binary. Doc tests do suffer from this as well from my experience.