MCPcopy Create free account
hub / github.com/bluejekyll/wasmtime-java / __alloc_bytes

Function __alloc_bytes

wasmtime-jni-exports/src/lib.rs:27–35  ·  view source on GitHub ↗

[cfg(target_arch = "wasm32")]

(size: u32)

Source from the content-addressed store, hash-verified

25#[no_mangle]
26//#[cfg(target_arch = "wasm32")]
27pub unsafe extern "C" fn __alloc_bytes(size: u32) -> i32 {
28 let layout = Layout::array::<u8>(size as usize).expect("u8 should definitely have a layout");
29 let ptr = alloc::alloc(layout) as i32;
30
31 debug_assert_ne!(0, ptr);
32 // useful for debugging
33 //println!("allocated {} at {}", size, ptr);
34 ptr
35}
36
37/// Frees ptr from `memory` in WASM
38///

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…