Struct wasmtime_runtime::MemoryImageSlot
source · pub struct MemoryImageSlot { /* private fields */ }
Expand description
A single slot handled by the copy-on-write memory initialization mechanism.
The mmap scheme is:
base ==> (points here)
- (image.offset bytes) anonymous zero memory, pre-image
- (image.len bytes) CoW mapping of memory image
- (up to static_size) anonymous zero memory, post-image
The ordering of mmaps to set this up is:
-
once, when pooling allocator is created:
- one large mmap to create 8GiB * instances * memories slots
-
per instantiation of new image in a slot:
- mmap of anonymous zero memory, from 0 to max heap size (static_size)
- mmap of CoW’d image, from
image.offset
toimage.offset + image.len
. This overwrites part of the anonymous zero memory, potentially splitting it into a pre- and post-region. - mprotect(PROT_NONE) on the part of the heap beyond the initial heap size; we re-mprotect it with R+W bits when the heap is grown.
Trait Implementations§
source§impl Debug for MemoryImageSlot
impl Debug for MemoryImageSlot
Auto Trait Implementations§
impl RefUnwindSafe for MemoryImageSlot
impl Send for MemoryImageSlot
impl Sync for MemoryImageSlot
impl Unpin for MemoryImageSlot
impl UnwindSafe for MemoryImageSlot
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more