Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 17 additions & 6 deletions crates/wasmtime/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2771,7 +2771,9 @@ impl PoolingAllocationConfig {

/// The maximum byte size that any WebAssembly linear memory may grow to.
///
/// This option defaults to 10 MiB.
/// This option defaults to 4 GiB meaning that for 32-bit linear memories
/// there is no restrictions. 64-bit linear memories will not be allowed to
/// grow beyond 4 GiB by default.
///
/// If a memory's minimum size is greater than this value, the module will
/// fail to instantiate.
Expand All @@ -2781,11 +2783,15 @@ impl PoolingAllocationConfig {
/// instruction.
///
/// This value is used to control the maximum accessible space for each
/// linear memory of a core instance.
///
/// The reservation size of each linear memory is controlled by the
/// `static_memory_maximum_size` setting and this value cannot exceed the
/// configured static memory maximum size.
/// linear memory of a core instance. This can be thought of as a simple
/// mechanism like [`Store::limiter`](crate::Store::limiter) to limit memory
/// at runtime. This value can also affect striping/coloring behavior when
/// used in conjunction with
/// [`memory_protection_keys`](PoolingAllocationConfig::memory_protection_keys).
///
/// The virtual memory reservation size of each linear memory is controlled
/// by the [`Config::static_memory_maximum_size`] setting and this method's
/// configuration cannot exceed [`Config::static_memory_maximum_size`].
pub fn max_memory_size(&mut self, bytes: usize) -> &mut Self {
self.config.limits.max_memory_size = bytes;
self
Expand All @@ -2802,6 +2808,11 @@ impl PoolingAllocationConfig {
/// regions are accessible each time executions switches from host to guest
/// (or vice versa).
///
/// Leveraging MPK requires configuring a smaller-than-default
/// [`max_memory_size`](PoolingAllocationConfig::max_memory_size) to enable
/// this coloring/striping behavior. For example embeddings might want to
/// reduce the default 4G allowance to 128M.
///
/// MPK is only available on Linux (called `pku` there) and recent x86
/// systems; we check for MPK support at runtime by examining the `CPUID`
/// register. This configuration setting can be in three states:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ impl Default for InstanceLimits {
// have 10k+ elements.
table_elements: 20_000,
max_memories_per_module: 1,
max_memory_size: 10 * (1 << 20), // 10 MiB
max_memory_size: 1 << 32, // 4G,
#[cfg(feature = "gc")]
total_gc_heaps: 1000,
}
Expand Down