[lug] Huge stack size--any reason to avoid?
blug-mail at duboulder.com
Wed Oct 25 13:32:04 MDT 2006
Vince Dean wrote:
> Thanks to all who responded. The responses tend to
> confirm my perception that putting big objects on the
> stack is unconventional and _might_ cause problems with
> performance and maintainability.
> There was concern that big objects on the stack
> would interfere with swapping. A large stack would
> tend to scatter frequently-used local variables across
> the memory space whereas a more compact stack would
> cluster them in a smaller number of pages.
> In our case, we have _lots_ of memory. Once we made the
> design decision to keep big data structures in memory,
> we were pretty much committed to providing enough physical
> memory to keep the program from swapping.
There is also the issue of blowing out the CPU on-board cache.
Your cache miss rate could be way higher with a fragmented
stack than with a normal-sized stack-frames.
More information about the LUG