[lug] Huge stack size--any reason to avoid?

Vince Dean vdean at ucar.edu
Wed Oct 25 13:24:30 MDT 2006

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.

In my own work, I would avoid putting big objects
on the stack, for all the reasons mentioned, but I'm not 
going to make a fuss about what someone else is doing, unless 
some specific problems arise.

For new work, I would first give serious consideration to a 
language like Java, with automatic memory management, other 
things being equal.


Vince Dean
University of Colorado 
Center for Lower Atmospheric Studies
3450 Mitchell Lane, Rm FL0-2514
Boulder, CO 80301
Phone: (303) 497-8077

More information about the LUG mailing list