Stream: wasmtime

Topic: Custom memory creators for host memories


view this post on Zulip Mat Gienieczko (Oct 19 2026 at 11:51):

Hello,

I've been looking more closely at my issue (#10740), which involves learning how wasmtime handles memory. I have a specific question for custom MemoryCreator implementations. The docs on Config::with_host_memory say:

Sets a custom memory creator.

Custom memory creators are used when creating host Memory objects [emph. mine] or when creating instance linear memories for the on-demand instance allocation strategy.

While I only used it for instance memories, I now noticed in the code that on the path for creating host Memories in trampoline/memory.rs the allocator used is always the default (OnDemandInstanceAllocator::default, line 55). This is unlike a similar helper in trampoline/table.rs (line 41) that uses the custom creator.

Is this an overlook or intended behaviour? If intended, why? What would be wrong if the custom creator was used instead of the default? This code was initially committed in PR 4187.

view this post on Zulip Adam Bratschi-Kaye (he) (Oct 19 2026 at 12:39):

I can't really say because I wasn't involved in the discussions, but possibly it was done just because there wasn't any interest in using the custom memory creator for shared memories? At Dfinity we were using the custom memory creator, but I had gotten the impression that there weren't many other users of that feature.

view this post on Zulip Mat Gienieczko (Oct 19 2026 at 12:43):

This path is used by calling Memory::new(store, ty) directly as well, doesn't have to be for shared memory

view this post on Zulip Alex Crichton (Oct 19 2026 at 14:15):

I think that's just a bug yeah and should be fine to fix


Last updated: Oct 31 2026 at 23:03 UTC