mirror of
https://github.com/roc-lang/roc.git
synced 2025-12-23 08:48:03 +00:00
Merge pull request #8204 from roc-lang/fix-deep-or-chain-stack-overflow
Fix stack overflows
This commit is contained in:
commit
272b35f8d7
1 changed files with 17 additions and 2 deletions
|
|
@ -371,10 +371,25 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
fn main() {
|
||||
env_logger::Builder::from_env("ROCLS_LOG").init();
|
||||
|
||||
// Tokio uses a smaller stack size for threads by default,
|
||||
// this can lead to stack overflows that don't show up with the roc release bin!
|
||||
let stack_size = 8 * 1024 * 1024; // 8MB
|
||||
|
||||
// Build a custom Tokio runtime with configured thread stack size
|
||||
let runtime = tokio::runtime::Builder::new_multi_thread()
|
||||
.thread_stack_size(stack_size)
|
||||
.enable_all()
|
||||
.build()
|
||||
.expect("Failed to create Tokio runtime");
|
||||
|
||||
// Run the async main function on our custom runtime
|
||||
runtime.block_on(async_main());
|
||||
}
|
||||
|
||||
async fn async_main() {
|
||||
let stdin = tokio::io::stdin();
|
||||
let stdout = tokio::io::stdout();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue