Skip to content
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

Merged
merged 1 commit into from
Jan 22, 2019
Merged

Conversation

ishitatsuyuki
Copy link
Contributor

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.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 16, 2019
@Mark-Simulacrum
Copy link
Member

@bors try

@bors
Copy link
Contributor

bors commented Jan 16, 2019

⌛ Trying commit 763392c with merge 4fffff535f16a7336e47d6930fe9cc50a2073b6e...

@bors
Copy link
Contributor

bors commented Jan 16, 2019

☀️ Test successful - checks-travis
State: approved= try=True

@Mark-Simulacrum
Copy link
Member

@rust-timer build 4fffff535f16a7336e47d6930fe9cc50a2073b6e

@rust-timer
Copy link
Collaborator

Success: Queued 4fffff535f16a7336e47d6930fe9cc50a2073b6e with parent e2f221c, comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking try commit 4fffff535f16a7336e47d6930fe9cc50a2073b6e

@ishitatsuyuki
Copy link
Contributor Author

ishitatsuyuki commented Jan 21, 2019

r? @nnethercote

Edit: couldn't assign as he/she isn't a rust-lang member, but anyway requesting a review based on git blame.

@nnethercote
Copy link
Contributor

Nice catch. How did you find it?

@bors r+

@bors
Copy link
Contributor

bors commented Jan 21, 2019

📌 Commit 763392c has been approved by nnethercote

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 21, 2019
Centril added a commit to Centril/rust that referenced this pull request Jan 21, 2019
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.
@ishitatsuyuki
Copy link
Contributor Author

Nothing special, I was just learning the AST internals and during the review of the source this came up.

Centril added a commit to Centril/rust that referenced this pull request Jan 22, 2019
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.
bors added a commit that referenced this pull request Jan 22, 2019
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
@bors bors merged commit 763392c into rust-lang:master Jan 22, 2019
@ishitatsuyuki ishitatsuyuki deleted the p-leak branch January 22, 2019 22:33
@@ -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));
Copy link
Member

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.

Centril added a commit to Centril/rust that referenced this pull request Mar 10, 2019
Centril added a commit to Centril/rust that referenced this pull request Mar 11, 2019
bors added a commit that referenced this pull request Mar 11, 2019
kennytm added a commit to kennytm/rust that referenced this pull request Mar 11, 2019
pietroalbini pushed a commit to pietroalbini/rust that referenced this pull request Apr 2, 2019
pietroalbini pushed a commit to pietroalbini/rust that referenced this pull request Apr 6, 2019
bors added a commit that referenced this pull request Apr 7, 2019
[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
bors added a commit that referenced this pull request Apr 8, 2019
[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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants