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
memory leak in DiagnosticBuilder.into_diagnostic() #69600
Activity
dwrensha commentedon Mar 1, 2020
We could avoid the leak and the
unsafeby doingor if we're concerned about performance here, we could maybe do something with
drop_in_place().nnethercote commentedon Mar 2, 2020
Thanks for the report, I will measure the perf effects of the different alternatives.
I'd like to know how you found this -- code inspection? Some kind of tool?
dwrensha commentedon Mar 2, 2020
I found it while running fuzz-rustc and noticing that I kept running out of memory. I turned on
-Z sanitizer=addressand this popped out.dwrensha commentedon Mar 2, 2020
Another alternative could be to call
std::mem::replace()to swap in a dummy diagnostic, instead of cloning the existing one.dwrensha commentedon Mar 2, 2020
Below is an example compiler input that triggers the leak:
dwrensha commentedon Mar 2, 2020
Simpler example that triggers the leak: just a single closing brace
}Fix a leak in `DiagnosticBuilder::into_diagnostic`.
Auto merge of #69628 - nnethercote:fix-DiagnosticBuilder-into_diagnos…
Rollup merge of rust-lang#69628 - nnethercote:fix-DiagnosticBuilder-i…
Rollup merge of rust-lang#69628 - nnethercote:fix-DiagnosticBuilder-i…
Fix a leak in `DiagnosticBuilder::into_diagnostic`.