MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / data_size

Method data_size

crates/wasmtime/src/runtime/memory.rs:506–508  ·  view source on GitHub ↗

Returns the byte length of this memory. WebAssembly memories are made up of a whole number of pages, so the byte size returned will always be a multiple of this memory's page size. Note that different Wasm memories may have different page sizes. You can get a memory's page size via the [`Memory::page_size`] method. By default the page size is 64KiB (aka `0x10000`, `2**16`, `1<<16`, or `65536`) b

(&self, store: impl AsContext)

Source from the content-addressed store, hash-verified

504 ///
505 /// Panics if this memory doesn't belong to `store`.
506 pub fn data_size(&self, store: impl AsContext) -> usize {
507 self.internal_data_size(store.as_context().0)
508 }
509
510 pub(crate) fn internal_data_size(&self, store: &StoreOpaque) -> usize {
511 store[self.instance].memory(self.index).current_length()

Callers 11

memory_zeroedFunction · 0.45
test_trapsFunction · 0.45
guards_presentFunction · 0.45
assert_guardsFunction · 0.45
memory_size_bytesMethod · 0.45
sizeMethod · 0.45
set_up_memoryFunction · 0.45
wasm_memory_data_sizeFunction · 0.45
make_api_callsFunction · 0.45
check_memory_accessesFunction · 0.45

Calls 3

internal_data_sizeMethod · 0.80
as_contextMethod · 0.45
byte_sizeMethod · 0.45

Tested by 4

memory_zeroedFunction · 0.36
test_trapsFunction · 0.36
set_up_memoryFunction · 0.36