Skip to main content

JS_NewRuntime2

Function JS_NewRuntime2 

Source
#[unsafe(no_mangle)]
pub unsafe extern "C" fn JS_NewRuntime2( _mf: *const JSMallocFunctions, _opaque: *mut c_void, ) -> *mut JsRuntime
Expand description

JS_NewRuntime2: a runtime with the host’s allocator.

The engine’s allocations go through Rust’s global allocator, which a C-supplied JSMallocFunctions cannot replace without a per-runtime allocator threaded through Gc. The runtime is created with the default allocator and the functions are ignored; a caller that needs its own allocator must not use this library. Recorded in the README.

§Safety

mf is ignored; the answer is a live runtime, or null when allocation fails.