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

Test "mem::uninit_write_slice_cloned_no_drop" leaks memory #80116

Closed
RalfJung opened this issue Dec 17, 2020 · 2 comments · Fixed by #80123
Closed

Test "mem::uninit_write_slice_cloned_no_drop" leaks memory #80116

RalfJung opened this issue Dec 17, 2020 · 2 comments · Fixed by #80123
Assignees
Labels
A-testsuite Area: The testsuite used to check the correctness of rustc C-bug Category: This is a bug.

Comments

@RalfJung
Copy link
Member

RalfJung commented Dec 17, 2020

The test mem::uninit_write_slice_cloned_no_drop added in #79607 leaks memory, which makes a Miri run of the test suite fail:

running 1 test
test mem::uninit_write_slice_cloned_no_drop ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 1176 filtered out

The following memory was leaked: alloc1884656 (Rust heap, size: 16, align: 8) {
    01 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 │ ................
}

Running Miri on the test suite is helpful to find bugs, so we should avoid deliberate leaks to still be able to detect accidental ones. Can the test be changed to use some other means of ensuring that drop is not called, e.g. with a Bomb type?

struct Bomb;

impl Drop for Bomb {
  fn drop(&mut self) { panic!(); }
}

Cc @drmeepster

@jonas-schievink jonas-schievink added A-testsuite Area: The testsuite used to check the correctness of rustc C-bug Category: This is a bug. labels Dec 17, 2020
@beepster4096
Copy link
Contributor

@rustbot claim

I made the test I should fix it

@RalfJung
Copy link
Member Author

@drmeepster thanks. :-) Let me know if you need any help.

RalfJung added a commit to RalfJung/rust that referenced this issue Dec 18, 2020
…, r=RalfJung

Fix memory leak in test "mem::uninit_write_slice_cloned_no_drop"

This fixes rust-lang#80116. I replaced the `Rc` based method I was using with a type that panics when dropped.
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Dec 20, 2020
…, r=RalfJung

Fix memory leak in test "mem::uninit_write_slice_cloned_no_drop"

This fixes rust-lang#80116. I replaced the `Rc` based method I was using with a type that panics when dropped.
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Dec 20, 2020
…, r=RalfJung

Fix memory leak in test "mem::uninit_write_slice_cloned_no_drop"

This fixes rust-lang#80116. I replaced the `Rc` based method I was using with a type that panics when dropped.
@bors bors closed this as completed in 59aaa2a Dec 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-testsuite Area: The testsuite used to check the correctness of rustc C-bug Category: This is a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants