MCPcopy Create free account
hub / github.com/dylan-sutton-chavez/edge-python / wasm_free

Function wasm_free

compiler/src/main/exports.rs:42–48  ·  view source on GitHub ↗
(ptr: *mut u8, size: u32)

Source from the content-addressed store, hash-verified

40/* Frees a `wasm_alloc` buffer. Host must pass the exact `size` it requested, a mismatched length rebuilds the wrong Box layout. Null or zero is a no-op. */
41#[unsafe(no_mangle)]
42pub unsafe extern "C" fn wasm_free(ptr: *mut u8, size: u32) {
43 if ptr.is_null() || size == 0 { return; }
44 unsafe {
45 let slice = core::slice::from_raw_parts_mut(ptr, size as usize);
46 let _ = Box::from_raw(slice as *mut [u8]);
47 }
48}
49
50#[unsafe(no_mangle)]
51pub unsafe extern "C" fn register_code_module(spec_ptr: *const u8, spec_len: u32, src_ptr: *const u8, src_len: u32) {

Callers 1

fetch_bytesMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected