-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Leak when returning out of box syntax #62289
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
Comments
Valgrind Memcheck also reports heap in use at exit on a Linux VM with the test linked above. |
Thanks a lot @agashlin for creating a reduced test case and creating this issue here. I stumbled over the original issue when carg-fuzz reported a memory leak in this code https://github.com/mozilla/webrtc-sdp/blob/3a46c37c6d11e2e856b946f4a2e11d90adde3af6/src/attribute_type.rs#L2060-L2062 This PR appears to fix the issue https://github.com/mozilla/webrtc-sdp/pull/151/files This was also with rustc 1.37.0-nightly on Linux. I can check if I can repro with the fuzz test case on other platforms. |
Looks like the early return doesn't interact well with box syntax's preallocation. MIR generation issue? cc @oli-obk |
rust/src/librustc_mir/build/expr/as_rvalue.rs Lines 127 to 132 in 848e0a2
Now that |
…r=matthewjasper Fix leak when early returning out of `box` syntax Fixes rust-lang#62289 r? @matthewjasper
…sper Fix leak when early returning out of `box` syntax Fixes #62289 r? @matthewjasper
Confirmed with my fuzzing test case that the problem is fixed in the latest rust nightly. |
@nils-ohlmeier mentioned a leak coming from
vec![f()?]
but notvec![f()?; 1]
here, I think I tracked this down to the use ofbox
invec!
when given a comma-separated list.I've made a smallish test that demonstrates it with
stats_alloc
, if it gets much simpler than this then the leak doesn't occur when built with --release.I'm testing on rustc 1.37.0-nightly (0af8e87 2019-06-30) nightly-x86_64-pc-windows-msvc, targeting x86_64-pc-windows-msvc.
The text was updated successfully, but these errors were encountered: