#Stack overflow investigation

10 messages · Page 1 of 1 (latest)

brave tangle
#

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...

#

Also is there a way of displaying the stack memory used by a function?

turbid shale
#

I think if you run your program with a debugger, you should be able to get a stack trace

stone terrace
daring bloom
#

If it's not recursion, it's from large types, which almost always means stack-allocated arrays. So check for arrays.

solid kettle
#

it's very likely to be unintended recursion, though, like a method calling itself when it should have been calling something else

brave tangle
#

Yes we have some big types: a type uses 1.5kb

daring bloom
#

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.

indigo helm
#

As a rule of thumb, stack sizes are a single-digit number of megabytes

#

They can be changed arbitrarily by the system administrator and by a program when spawning a thread, but usually aren't