Skip to main content

R_PreserveObject_unchecked

Function R_PreserveObject_unchecked 

Source
pub unsafe extern "C-unwind" fn R_PreserveObject_unchecked(
    object: SEXP,
)
Expand description

Add a SEXP to the global precious list, preventing GC indefinitely.

Cost: O(1) but allocates a CONSXP cell — creates GC pressure on every call. The precious list is a global linked list (R_PreciousList).

Use only for long-lived objects (e.g., ExternalPtr stored across R calls). For temporary protection within a function, prefer Rf_protect. Unchecked FFI binding for R_PreserveObject. Generated from source location line 2118, column 12. Generated from source file miniextendr-api/src/ffi.rs.