Skip to main content

GC_oom_func

Type Alias GC_oom_func 

Source
pub type GC_oom_func = Option<unsafe extern "C" fn(arg1: usize) -> *mut c_void>;
Expand description

When there is insufficient memory to satisfy an allocation request, we return (*GC_oom_fn)(size). If it returns, it must return either NULL or a valid pointer to a previously allocated heap object. By default, this just returns NULL. If it points to a function which never returns NULL, probably by aborting the program instead, then invocations of GC_MALLOC() and friends (that are additionally marked as “never returning NULL unless GC_oom_fn returns NULL”) do not need to be followed by code that checks for the NULL result. GC_oom_fn must not be 0. Both the setter and the getter acquire the allocator lock (in the reader mode in case of the getter) to avoid data race.

Aliased Type§

pub enum GC_oom_func {
    None,
    Some(unsafe extern "C" fn(usize) -> *mut c_void),
}

Variants§

§1.0.0

None

No value.

§1.0.0

Some(unsafe extern "C" fn(usize) -> *mut c_void)

Some value of type T.