Function magnus::gc::unregister_address

source ·
pub fn unregister_address<T>(valref: &T)
where T: Mark,
Expand description

Inform Ruby’s garbage collector that valref that was previously registered with register_address no longer points to a live Ruby object.

§Examples

use magnus::{gc, RString};

let s = RString::new("example");

// s won't be collected even though it's on the heap
let boxed = Box::new(s);
gc::register_address(&*boxed);

// ...

// allow s to be collected
gc::unregister_address(&*boxed);
drop(boxed);