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

Function probe_engine_size

examples/mpk.rs:93–113  ·  view source on GitHub ↗

Find the engine with the largest number of memories we can create on this machine.

(args: &Args, mpk: Enabled)

Source from the content-addressed store, hash-verified

91/// Find the engine with the largest number of memories we can create on this
92/// machine.
93fn probe_engine_size(args: &Args, mpk: Enabled) -> Result<Pool> {
94 let mut search = ExponentialSearch::new();
95 let mut mapped_bytes = 0;
96 while !search.done() {
97 match build_engine(&args, search.next(), mpk) {
98 Ok(rb) => {
99 // TODO: assert!(rb >= mapped_bytes);
100 mapped_bytes = rb;
101 search.record(true)
102 }
103 Err(e) => {
104 warn!("failed engine allocation, continuing search: {e:?}");
105 search.record(false)
106 }
107 }
108 }
109 Ok(Pool {
110 num_memories: search.next(),
111 mapped_bytes,
112 })
113}
114
115#[derive(Debug)]
116struct Pool {

Callers 1

mainFunction · 0.85

Calls 6

OkFunction · 0.85
build_engineFunction · 0.70
newFunction · 0.50
doneMethod · 0.45
nextMethod · 0.45
recordMethod · 0.45

Tested by

no test coverage detected