Hi! I am working on a big project written in Rust. I recently added a new feature at the codebase. Unfortunately I keep getting stack overflows. No recursion is implied. I am trying to understand where the stack memory is consumed. Have you some recommended tools? I tried flamegraph, however it doesn't help. Tools seems missing...
#Stack overflow investigation
10 messages · Page 1 of 1 (latest)
I think if you run your program with a debugger, you should be able to get a stack trace
cargo build
rust-lldb --one-line r --one-line bt -- target/debug/your_binary <binary args...>
If it's not recursion, it's from large types, which almost always means stack-allocated arrays. So check for arrays.
it's very likely to be unintended recursion, though, like a method calling itself when it should have been calling something else
Yes we have some big types: a type uses 1.5kb
That's not really that big. It's big enough that you shouldn't be copying it, but not big enough to cause stack overflows by itself.