3 ms·
Check every function's automatic variables' sizes, add them all up, and add whatever function call frame size the compiler and ABI are using. Getting an exact
by cryptonector 5y ago
Check every function's automatic variables' sizes, add them all up, and add whatever function call frame size the compiler and ABI are using. Getting an exact accounting of function call stack memory usage is tricky because you might have framepointer-less code, and you might have inlining of function calls, but you can figure it out assuming no inlining and assuming you don't enable framepointer-less-ness.
- alcover 5y agoThank you. It doesn't err.. look super straightforward. I was hoping for an automated way of some sort. This stack affair of `local arrays are super fast! but keep it small, 1024 should be okay` is very puzzling to aspiring C lovers like me.
- cryptonector 5y agoThere's a way to dump DWARF debug information that you might then be able to parse and use to do just this.