-
Notifications
You must be signed in to change notification settings - Fork 356
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 leaks do not show where the original allocation occurs #2813
Comments
We could record a backtrace or a span for the allocation location in Miri, but these leak reports are produced by code in |
Would a comment mentioning using |
That was completely accidental, I did not intend to click the close with comment button. |
Don't we already have a callback for creating new allocs' stacked borrow datastructure? Maybe we can do sth there. For diagnostics it seems alright to use thread local storage instead of threading (heh) through an InterpCx all the way |
Printing some advice would be better than nothing, but if the user is debugging a leak in a program that requires isolation to be off, it is possible that the offending allocation ID changes randomly between runs. I am also currently debugging this: https://github.com/rust-lang/miri-test-libstd/actions/runs/4395316008/jobs/7697019211#step:4:770 which is a leak which only appears after 15 minutes of runtime, with isolation off. We can certainly hold the state that's required in Miri's |
Thanks for the report! However, I think this is a duplicate of #1481. |
Add a backtrace to Allocation, display it in leak reports This addresses rust-lang/miri#2813 Information like this from diagnostics is indispensable for diagnosing problems that are difficult to reproduce such as https://github.com/rust-lang/miri-test-libstd/actions/runs/4395316008/jobs/7697019211#step:4:770 (which has not been reproduced or diagnosed).
Add a backtrace to Allocation, display it in leak reports This addresses rust-lang#2813 Information like this from diagnostics is indispensable for diagnosing problems that are difficult to reproduce such as https://github.com/rust-lang/miri-test-libstd/actions/runs/4395316008/jobs/7697019211#step:4:770 (which has not been reproduced or diagnosed).
Take the following code:
which produces the following output with
cargo miri run
:The error message does not mention where the allocation of the memory that has been leaked occurs. A mention of what line the allocates the leaked memory or a backtrace of calls leading up to the allocation would make it significantly easier to figure out what needs to be done to fix the memory leak especially in more complex situations.
The text was updated successfully, but these errors were encountered: