keep-runtime: Prefer dynamic memory allocation
By default, wasmtime internally allocates 4GiB of memory once at the
startup, which does not fit well in our SGX heap.  This configures
wasmtime to only do dynamic memory allocation.
Related to
@@ -32,7 +32,10 @@ pub fn run<T: AsRef<[u8]>, U: AsRef<[u8]>, V: std::borrow::Borrow<(U, U)>>(
args: impl IntoIterator<Item = T>,
envs: impl IntoIterator<Item = V>,
) -> Result<Box<[wasmtime::Val]>> {
- let engine = wasmtime::Engine::default();
+ let mut config = wasmtime::Config::new();
+ // Prefer dynamic memory allocation style over static memory
+ config.static_memory_maximum_size(0);
+ let engine = wasmtime::Engine::new(&config);
let store = wasmtime::Store::new(&engine);
// Instantiate WASI
