Function magnus::gc::register_address

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

Inform Ruby’s garbage collector that valref points to a live Ruby object.

Prevents Ruby moving or collecting valref. This should be used on static items to prevent them being collected instead of relying on Ruby constants/globals to allways refrence the value.

See also BoxValue.