From fe2f23c4a55bfe38788f0d19aa1bf78d3bc82fcf Mon Sep 17 00:00:00 2001 From: eric Date: Mon, 8 Mar 2021 09:09:53 +0800 Subject: [PATCH] bin: larger stack size for debugging --- leaf-bin/src/main.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/leaf-bin/src/main.rs b/leaf-bin/src/main.rs index 530e997..094db08 100644 --- a/leaf-bin/src/main.rs +++ b/leaf-bin/src/main.rs @@ -17,6 +17,16 @@ fn get_version_string() -> String { } } +#[cfg(debug_assertions)] +fn default_thread_stack_size() -> usize { + 2097152 +} + +#[cfg(not(debug_assertions))] +fn default_thread_stack_size() -> usize { + 24576 +} + fn main() { let matches = App::new("leaf") .version(get_version_string().as_str()) @@ -44,7 +54,7 @@ fn main() { .value_name("BYTES") .about("Sets the stack size of runtime threads.") .takes_value(true) - .default_value("24576"), + .default_value(&default_thread_stack_size().to_string()), ) .arg( Arg::new("test-outbound")