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

Method grow

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

Grows this WebAssembly memory by `delta` pages. This will attempt to add `delta` more pages of memory on to the end of this `Memory` instance. If successful this may relocate the memory and cause [`Memory::data_ptr`] to return a new value. Additionally any unsafely constructed slices into this memory may no longer be valid. On success returns the number of pages this memory previously had before

(&self, mut store: impl AsContextMut, delta: u64)

Source from the content-addressed store, hash-verified

635 /// # }
636 /// ```
637 pub fn grow(&self, mut store: impl AsContextMut, delta: u64) -> Result<u64> {
638 let store = store.as_context_mut().0;
639 let (mut limiter, store) = store.validate_sync_resource_limiter_and_store_opaque()?;
640 vm::assert_ready(self._grow(store, limiter.as_mut(), delta))
641 }
642
643 /// Async variant of [`Memory::grow`]. Required when using a
644 /// [`ResourceLimiterAsync`](`crate::ResourceLimiterAsync`).

Callers 15

test_limitsFunction · 0.45
test_limits_memory_onlyFunction · 0.45
test_limits_table_onlyFunction · 0.45
panic_in_memory_limiterFunction · 0.45
panic_in_table_limiterFunction · 0.45
growth_trapFunction · 0.45

Calls 8

OkFunction · 0.85
assert_readyFunction · 0.70
as_context_mutMethod · 0.45
_growMethod · 0.45
as_mutMethod · 0.45
unwrapMethod · 0.45
page_sizeMethod · 0.45

Tested by 15

test_limitsFunction · 0.36
test_limits_memory_onlyFunction · 0.36
test_limits_table_onlyFunction · 0.36
static_forced_maxFunction · 0.36
i31ref_table_growFunction · 0.36