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

Root count overflows in mem::forget loop, leading to erroneous drop #34

Closed
apasel422 opened this issue Aug 6, 2016 · 0 comments
Closed

Comments

@apasel422
Copy link
Contributor

Running the following in release mode causes a segfault:

extern crate gc;

use gc::Gc;
use std::{mem, usize};

fn main() {
    let a = Gc::new("abc".to_string());
    let a2 = a.clone();

    for _ in 0..usize::MAX {
        mem::forget(a.clone());
    }

    drop(a2);
    gc::force_collect();
    println!("{:?}", *a);
}

This is the same issue that was fixed in rust-lang/rust#27174. I have a fix incoming.

@apasel422 apasel422 changed the title Root count overflows in mem::forget loop, leading to premature drop Root count overflows in mem::forget loop, leading to erroneous drop Aug 6, 2016
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

1 participant