Type Alias mozjs::jsapi::JS::OutOfMemoryCallback
source · pub type OutOfMemoryCallback = Option<unsafe extern "C" fn(_: *mut JSContext, _: *mut c_void)>;
Expand description
Unlike the error reporter, which is only called if the exception for an OOM bubbles up and is not caught, the OutOfMemoryCallback is called immediately at the OOM site to allow the embedding to capture the current state of heap allocation before anything is freed. If the large-allocation-failure callback is called at all (not all allocation sites call the large-allocation-failure callback on failure), it is called before the out-of-memory callback; the out-of-memory callback is only called if the allocation still fails after the large-allocation-failure callback has returned.
Aliased Type§
enum OutOfMemoryCallback {
None,
Some(unsafe extern "C" fn(_: *mut JSContext, _: *mut c_void)),
}