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
| // 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.
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.