Consider the following program:
fn recursive_call(x: u32) -> u32 {
    println!("x: {:?}", x);
    recursive_call(x +1)
}
fn main() {
    recursive_call(0);
}
When I run cargo build && ./target/debug/recursive_call, this crashes after x: 58152:
x: 58152
thread 'main' has overflowed its stack
fatal runtime error: stack overflow
Aborted (core dumped)
while when I run  cargo build --release && ./target/release/recursive_call, this crashes only after x: 104728:
x: 104728
thread 'main' has overflowed its stack
[...]
I wondering where this difference in behavior comes from? Is the stack size different in release vs. debug mode? Or is this because of some compile time optimizations I am missing (if so, what would so optimizations be?)
 
     
    