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

Leak checker doesn't see through AtomicPtr #1350

Closed
vorner opened this issue Apr 18, 2020 · 2 comments
Closed

Leak checker doesn't see through AtomicPtr #1350

vorner opened this issue Apr 18, 2020 · 2 comments

Comments

@vorner
Copy link

vorner commented Apr 18, 2020

Hello

I had miri report a leak in my code and after searching for it for a while, I believe it is a false positive. I've created a reproducer which should demonstrate it. The allocated memory is still reachable through the AtomicPtr, but miri doesn't see it.

use std::sync::atomic::{AtomicPtr, Ordering};
use std::ptr;

static X: AtomicPtr<usize> = AtomicPtr::new(ptr::null_mut());

fn main() {
    X.store(Box::into_raw(Box::new(42usize)), Ordering::Relaxed);
}

I think it might be somewhat similar to #1318 (I suspect the AtomicPtr might be considered usize internally).

@bjorn3
Copy link
Member

bjorn3 commented Apr 18, 2020

I think it might be somewhat similar to #1318 (I suspect the AtomicPtr might be considered usize internally).

Yes. rust-lang/rust#70765 will fix this if it lands.

@RalfJung
Copy link
Member

Yes. rust-lang/rust#70765 will fix this if it lands.

Yeah... but it seems unlike that that will land, honestly. :/

I think it might be somewhat similar to #1318 (I suspect the AtomicPtr might be considered usize internally).

Indeed, I'll close this as a duplicate -- I see no good reason to track this separately.

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

No branches or pull requests

3 participants