core::arch::wasm

Function memory_size

Source
pub fn memory_size(const MEM: u32) -> usize
🔬This is a nightly-only experimental API. (simd_wasm64 #90599)
Available on target_family="wasm" only.
Expand description

Corresponding intrinsic to wasm’s memory.size instruction

This function, when called, will return the current memory size in units of pages. The current WebAssembly page size is 65536 bytes (64 KB).

The argument MEM is the numerical index of which memory to return the size of. Note that currently the WebAssembly specification only supports one memory, so it is required that zero is passed in. The argument is present to be forward-compatible with future WebAssembly revisions. If a nonzero argument is passed to this function it will currently unconditionally abort.