-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Valgrind full leak check reports a leak on Rust 1.83.0 #133574
Comments
This is almost certainly a deliberate leak. You seem to be using a fairly old version of valgrind. It's quite possible a newer version would recognise it's not a leak. |
looks like it could be, reported in case it isn't (different behavior than 1.82.0)
the latest valgrind gives us more info
|
This actually seems to be fixed in beta, so I think it's a 1.83 regression. It seemed a bit annoying to deal with because I only noticed it in the unit test runner ( EDIT, since that probably didn't make sense: we're using |
Can you cargo-bisect-rustc the PR that fixed it, to see if we'd like to backport it? |
According to lnicola, this is fixed on beta. |
As discussed regarding intentional "leaks", "valgrind reports a leak" does not mean "a memory leak occurred". There are many APIs in the standard library that create a small, permanent allocation, and then deliberately defer collection of that memory to process exit. They do not grow. A memory leak, as far as we are concerned, is unbounded memory usage, and this is not. And this is already fixed, so. Closing. |
While it's not necessarily a bug, I think keepikg the Rust runtime free of memory leaks as far as Valgrind is concerned is good, to ensure people can use Valgrind to find leaks in their code. |
@Noratrieb valgrind's documentation explains this problem, that they should be ignored via generating suppressions, and that it should not be run with the full leak check in most cases. Should we support using valgrind in contravention of its documentation? |
Ah, this is a non-default full leak check, I see. Fair in that case, I will rename the issue to make that more explicit and close it again, I don't think we need to support that in this case. |
Thanks for the comments. Given the above, I suppose the current options for valgrind (w/
|
This is not a permanent allocation, those are reported as "still reachable" by Valgrind. This is reported as "possibly lost". One example is: char *p = malloc(2);
p += 1;
// the allocation is possibly lost here
p -= 1;
// we recovered it, false alarm I bisected, it was introduced in fd1f8aa and fixed in f61306d. Unfortunately, |
Thank you for confirming that, @lnicola. I don't think we should backport that commit if there is a stable release. But if this regression been caught on beta or nightly, @sharksforarms, we would have made some effort to make it happen so it didn't reach the release. That's not a guarantee, no, but we do still appreciate that this is an inconvenience. |
Hi all, creating this issue as I noticed our CI failing due to valgrind when updating from 1.82.0 to 1.83.0, the leak seems to be from rust and not from the application (reproducible with default
cargo new --bin
). Others may also hit this.Code
I expected to see this happen: valgrind reports no leak
Instead, this happened: valgrind reports a leak
Version it worked on
It most recently worked on: Rust 1.82.0
Version with regression
rustc --version --verbose
:The text was updated successfully, but these errors were encountered: