3 ms·
How does something like Ada help you measure and control stack usage?
by jeff-davis 5y ago
How does something like Ada help you measure and control stack usage?
- nagisa 5y agoMeasuring of stack requirements is typically implemented by the way of walking the call graph and adding up functions' stack sizes (for usual function these are well known at compile time). There are “only” a couple problematic cases where this algorithm fails: recursion, `alloca` and the likes, and indirect calls. For all of these problems there are more complex analyses that can be done to determine e.g. maximum recursion depth or possible functions that an indirect call could resolve to. And failing all of these there is usually a way for an engineer to override or provide this information.