mirror of
https://github.com/fluencelabs/wasmer
synced 2025-06-29 00:21:34 +00:00
Fix some reviewed items
This commit is contained in:
@ -7,6 +7,19 @@ use crate::{
|
||||
|
||||
pub const DYNAMIC_GUARD_SIZE: usize = 4096;
|
||||
|
||||
/// This is an internal-only api.
|
||||
///
|
||||
/// A Dynamic memory allocates only the minimum amount of memory
|
||||
/// when first created. Over time, as it grows, it may reallocate to
|
||||
/// a different location and size.
|
||||
///
|
||||
/// Dynamic memories are signifigantly faster to create than static
|
||||
/// memories and use much less virtual memory, however, they require
|
||||
/// the webassembly module to bounds-check memory accesses.
|
||||
///
|
||||
/// While, a dynamic memory could use a vector of some sort as its
|
||||
/// backing memory, we use mmap (or the platform-equivalent) to allow
|
||||
/// us to add a guard-page at the end to help elide some bounds-checks.
|
||||
pub struct DynamicMemory {
|
||||
memory: sys::Memory,
|
||||
current: u32,
|
||||
|
@ -8,6 +8,17 @@ use crate::{
|
||||
vm,
|
||||
};
|
||||
|
||||
/// This is an internal-only api.
|
||||
///
|
||||
/// A static memory allocates 6GB of *virtual* memory when created
|
||||
/// in order to allow the webassembly module to contain no bounds-checks.
|
||||
///
|
||||
/// Additionally, static memories stay at a single virtual address, so there is no need
|
||||
/// to reload its address on each use.
|
||||
///
|
||||
/// Static memories take a relatively long time to create, so if memories are short-lived,
|
||||
/// it's recommended that a dynamic memory is used. There is currently no user-facing api that
|
||||
/// allows them to select the type of memory used however.
|
||||
pub struct StaticMemory {
|
||||
memory: sys::Memory,
|
||||
current: u32,
|
||||
|
Reference in New Issue
Block a user