1 2 3 4 5 6 7 8 9 10
use std::mem; // TODO: limit alloc size #[no_mangle] pub extern "C" fn alloc(size: i32) -> *mut u8 { let mut buf: Vec<u8> = Vec::with_capacity(size as _); let ptr = buf.as_mut_ptr(); mem::forget(buf); return ptr; }