-
Notifications
You must be signed in to change notification settings - Fork 386
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
Memleak #142
Conversation
//error-pattern: the evaluated program leaked memory | ||
|
||
fn main() { | ||
std::mem::forget(Box::new(42)); |
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.
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.
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.
done
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.
Looks great!
tests/run-pass/move_fn_closure.rs
Outdated
@@ -0,0 +1,24 @@ | |||
struct Foo<'a>(&'a mut bool); |
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.
You should probably merge this file with the existing https://github.com/solson/miri/blob/master/tests/run-pass/closure-drop.rs.
tests/run-pass/closure-drop.rs
Outdated
@@ -26,5 +26,15 @@ fn main() { | |||
f(g); |
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.
I meant removing the FIXME
above this and simplifying it all. :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.
gotta rustup first
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.
rustupped and fixed
instead of duplicating all the code from `write_value`, we forward to it.
Expand drain to accept any RangeBounds<usize>
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