Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory leak/spike during doc-tests #14190

Closed
madonuko opened this issue Jul 4, 2024 · 1 comment
Closed

Memory leak/spike during doc-tests #14190

madonuko opened this issue Jul 4, 2024 · 1 comment
Labels
A-doctests Area: rustdoc --test C-bug Category: bug S-triage Status: This issue is waiting on initial triage.

Comments

@madonuko
Copy link

madonuko commented Jul 4, 2024

Problem

Both cargo test and cargo test --doc use around (1 + n) GB of memory during doc-test linking, where n is the number of doc-tests. This behaviour can be seen here:

2024-07-04.19-59-38.copy.mp4

The code in question is https://github.com/rpm-rs/rpmspec-rs (master branch or commit 1e57d1d)

Steps

git clone https://github.com/rpm-rs/rpmspec-rs --depth 1
cd rpmspec-rs
cargo test #--doc

Try removing one of the doc-tests. On my machine, for every doc-test I remove, the memory usage drops by 1 GB.

Possible Solution(s)

No response

Notes

Things I have already tried

Extra notes

Notice the memory usage comes from ld (see the video above). However, this only happens with doc-tests; this never happens under cargo check, cargo build and normal tests (i.e. cargo test excluding doc-tests).

Version

cargo 1.79.0 (ffa9cf99a 2024-06-03)
release: 1.79.0
commit-hash: ffa9cf99a594e59032757403d4c780b46dc2c43a
commit-date: 2024-06-03
host: x86_64-unknown-linux-gnu
libgit2: 1.7.2 (sys:0.18.3 vendored)
libcurl: 8.6.0-DEV (sys:0.4.72+curl-8.6.0 vendored ssl:OpenSSL/1.1.1w)
ssl: OpenSSL 1.1.1w  11 Sep 2023
os: Ultramarine Linux 40.0.0 (lostumbrella) [64-bit]
@madonuko madonuko added C-bug Category: bug S-triage Status: This issue is waiting on initial triage. labels Jul 4, 2024
@madonuko madonuko changed the title Memory leak during doc-tests Memory leak/spike during doc-tests Jul 4, 2024
@weihanglo
Copy link
Member

This is not a memory "leak". Under the current architecture, each doctest compiles to a separate binary on-the-fly, so there are N linking happening when compile N doctests.

See some other issues:

We've already come up with some other ideas to resolve this. See:

Close in favor of those issues. Thank you.

@weihanglo weihanglo closed this as not planned Won't fix, can't repro, duplicate, stale Jul 4, 2024
@weihanglo weihanglo added the A-doctests Area: rustdoc --test label Jul 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-doctests Area: rustdoc --test C-bug Category: bug S-triage Status: This issue is waiting on initial triage.
Projects
None yet
Development

No branches or pull requests

2 participants