Skip to content

Memleak #142

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

Merged
merged 8 commits into from
Feb 24, 2017
Merged

Memleak #142

merged 8 commits into from
Feb 24, 2017

Conversation

oli-obk
Copy link
Contributor

@oli-obk oli-obk commented Feb 14, 2017

check for memory leaks after the interpretation is finished and error if any memory leaks occurred.

After fixing the bugs leading to leaks, no regressions were noticed in the rustc test suite.

fixes #135

//error-pattern: the evaluated program leaked memory

fn main() {
std::mem::forget(Box::new(42));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you also add a test for an Rc cycle? There should be examples around back from before mem::forget was made safe, with the whole scoped threads discussion.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Copy link
Member

@solson solson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@@ -0,0 +1,24 @@
struct Foo<'a>(&'a mut bool);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should probably merge this file with the existing https://github.com/solson/miri/blob/master/tests/run-pass/closure-drop.rs.

@@ -26,5 +26,15 @@ fn main() {
f(g);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant removing the FIXME above this and simplifying it all. :P

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gotta rustup first

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rustupped and fixed

@solson solson merged commit c502bb8 into rust-lang:master Feb 24, 2017
@oli-obk oli-obk deleted the memleak branch March 17, 2017 09:35
erickt pushed a commit to erickt/miri that referenced this pull request Feb 4, 2022
Expand drain to accept any RangeBounds<usize>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

miri doesn't drop values moved into closures with let _ = x
3 participants