Hi! I saw this wasmtime::runtime::vm::memory
defined as a box of runtime linear memory
pub struct Memory(pub(crate) Box<dyn RuntimeLinearMemory>);
But there is also wasmtime::runtime::memory
pub struct Memory(Stored<crate::runtime::vm::ExportMemory>);
I know the first one and its implementations like MmapMemory, but what is the second struct for?
The second structure is wasmtime::Memory
, the public crate export, and it points to the other basically
The first Memory
used to be in a crate called wasmtime-runtime
which was later merged into the wasmtime
crate and we haven't gotten around to renaming everything necessarily to suit.
Oh thank you! BTW, I suppose the start address of a Linear Memory doesn't change through out it's lifetime?
It might, but it typically won't. The default settings of Wasmtime means that it won't change over time as all memories are "static" meaning we make a huge virtual memory reservation. Wasmtime can be tuned, however, to have "dynamic" memories where manual bounds checks are inserted in compiled code and in this case the base pointer of memory may move on growth
Last updated: Nov 22 2024 at 17:03 UTC