Skip to content

Commit

Permalink
Add a CLI option for the maximum stack size (#5156)
Browse files Browse the repository at this point in the history
This should allow either increasing or decreasing it for debugging and
otherwise prodding at stack overflow behavior from the CLI.
  • Loading branch information
alexcrichton authored Oct 31, 2022
1 parent b7b914f commit 95ecb7e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions crates/cli-flags/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,11 @@ pub struct CommonOptions {
#[cfg(feature = "pooling-allocator")]
#[clap(long)]
pub pooling_allocator: bool,

/// Maximum stack size, in bytes, that wasm is allowed to consumed before a
/// stack overflow is reported.
#[clap(long)]
pub max_wasm_stack: Option<usize>,
}

impl CommonOptions {
Expand Down Expand Up @@ -335,6 +340,10 @@ impl CommonOptions {
}
}

if let Some(max) = self.max_wasm_stack {
config.max_wasm_stack(max);
}

Ok(config)
}

Expand Down

0 comments on commit 95ecb7e

Please sign in to comment.