-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Fix memory leak in P::filter_map #57667
Conversation
@bors try |
⌛ Trying commit 763392c with merge 4fffff535f16a7336e47d6930fe9cc50a2073b6e... |
☀️ Test successful - checks-travis |
@rust-timer build 4fffff535f16a7336e47d6930fe9cc50a2073b6e |
Success: Queued 4fffff535f16a7336e47d6930fe9cc50a2073b6e with parent e2f221c, comparison URL. |
Finished benchmarking try commit 4fffff535f16a7336e47d6930fe9cc50a2073b6e |
r? @nnethercote Edit: couldn't assign as he/she isn't a rust-lang member, but anyway requesting a review based on git blame. |
Nice catch. How did you find it? @bors r+ |
📌 Commit 763392c has been approved by |
Fix memory leak in P::filter_map Probably this function isn't widely used, but anyway this wasn't working as intended. r? @eddyb Do not rollup if you want to see if max-rss change in perf.
Nothing special, I was just learning the AST internals and during the review of the source this came up. |
Fix memory leak in P::filter_map Probably this function isn't widely used, but anyway this wasn't working as intended. r? @eddyb Do not rollup if you want to see if max-rss change in perf.
Rollup of 9 pull requests Successful merges: - #57537 (Small perf improvement for fmt) - #57552 (Default images) - #57604 (Make `str` indexing generic on `SliceIndex`.) - #57667 (Fix memory leak in P::filter_map) - #57677 (const_eval: Predetermine the layout of all locals when pushing a stack frame) - #57791 (Add regression test for #54582) - #57798 (Corrected spelling inconsistency) - #57809 (Add powerpc64-unknown-freebsd) - #57813 (fix validation range printing when encountering undef) Failed merges: r? @ghost
@@ -101,6 +101,7 @@ impl<T: 'static> P<T> { | |||
// Recreate self from the raw pointer. | |||
Some(P { ptr: Box::from_raw(p) }) | |||
} else { | |||
drop(Box::from_raw(p)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is wrong, because of the ptr::read(p)
call above - you need to deallocate without dropping the T
value inside the Box
.
[beta] Rollup backports Cherry-picked: * #58021: Fix fallout from #57667 * #59599: Updated RELEASES.md for 1.34.0 * #59587: Remove #[doc(hidden)] from Error::type_id * #58994: Hide deprecation warnings inside derive expansions * #58015: Expand docs for `TryFrom` and `TryInto`. * #59770: ci: pin android emulator to 28.0.23 * #59704: ci: Update FreeBSD tarball downloads * #59257: Update CI configuration for building Redox libraries * #59724: Function arguments should never get promoted r? @ghost
[beta] Rollup backports Cherry-picked: * #58021: Fix fallout from #57667 * #59599: Updated RELEASES.md for 1.34.0 * #59587: Remove #[doc(hidden)] from Error::type_id * #58994: Hide deprecation warnings inside derive expansions * #58015: Expand docs for `TryFrom` and `TryInto`. * #59770: ci: pin android emulator to 28.0.23 * #59704: ci: Update FreeBSD tarball downloads * #59257: Update CI configuration for building Redox libraries * #59724: Function arguments should never get promoted * #59499: Fix broken download link in the armhf-gnu image * #58330: Add rustdoc JS non-std tests * #58848: Prevent cache issues on version updates r? @ghost
Probably this function isn't widely used, but anyway this wasn't working as intended.
r? @eddyb
Do not rollup if you want to see if max-rss change in perf.