Type Definition js::jsapi::OutOfMemoryCallback [] [src]

type OutOfMemoryCallback = Option<unsafe extern "C" fn(cx: *mut JSContext, data: *mut c_void)>;

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.