Skip to content

Leak checker doesn't see through AtomicPtr #1350

@vorner

Description

@vorner

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions