Rust program overflows stack, but not in benchmarks

⚓ Rust    📅 2025-07-14    👤 surdeus    👁️ 4      

surdeus

I'm writing a programming language and I have a simple program that loops 5,000,000 times. This causes a stack overflow when I run the program through my binary with cargo run. However, the benchmark that runs the exact same function using criterion does not cause a stack overflow.

Why is this happening? To be clear, I understand why the stack overflow is happening, I'm just wandering what it is that makes the benchmark case different so as to prevent the overflow.

5 posts - 4 participants

Read full topic

🏷️ rust_feed