Create new MmapMemory
(
&self,
ty: &wasmtime_environ::Memory,
memory_tunables: &MemoryTunables<'_>,
minimum: usize,
maximum: Option<usize>,
)
| 129 | impl RuntimeMemoryCreator for DefaultMemoryCreator { |
| 130 | /// Create new MmapMemory |
| 131 | fn new_memory( |
| 132 | &self, |
| 133 | ty: &wasmtime_environ::Memory, |
| 134 | memory_tunables: &MemoryTunables<'_>, |
| 135 | minimum: usize, |
| 136 | maximum: Option<usize>, |
| 137 | ) -> Result<Box<dyn RuntimeLinearMemory>> { |
| 138 | #[cfg(has_virtual_memory)] |
| 139 | if memory_tunables.tunables().signals_based_traps |
| 140 | || memory_tunables.guard_size() > 0 |
| 141 | || memory_tunables.reservation() > 0 |
| 142 | || memory_tunables.tunables().memory_init_cow |
| 143 | { |
| 144 | return Ok( |
| 145 | try_new::<Box<_>>(MmapMemory::new(ty, memory_tunables, minimum, maximum)?)? |
| 146 | as Box<dyn RuntimeLinearMemory>, |
| 147 | ); |
| 148 | } |
| 149 | |
| 150 | let _ = maximum; |
| 151 | Ok( |
| 152 | try_new::<Box<_>>(MallocMemory::new(ty, memory_tunables, minimum)?)? |
| 153 | as Box<dyn RuntimeLinearMemory>, |
| 154 | ) |
| 155 | } |
| 156 | } |
| 157 | |
| 158 | /// A linear memory and its backing storage. |
no test coverage detected