[lug] Huge stack size--any reason to avoid?
zlynx at acm.org
Thu Oct 26 08:14:24 MDT 2006
On Thu, 2006-10-26 at 04:27 -0600, Sean Reifschneider wrote:
> On Wed, Oct 25, 2006 at 02:18:28PM -0600, Zan Lynx wrote:
> >I suspect that the stack isn't fragmented at all. A stack can't be,
> >really. The big memory use is probably allocated somewhere high up the
> My understanding of the discussion about fragmented stack is what I'd call
> duplicated objects on the stack. If you're passing around a 1MB struct on
> the stack, instead of the pointer to the object, and you have a 1MB L2
> cache, you're going to end up having to hit main memory much more
> frequently. Because every function call with this big object is going to
> create a new copy of this 1MB of data, and access the new copy. When you
> return, it's going to have to pull in the old copy from main memory.
Passing around copies of giant objects instead of references or pointers
is just as silly for objects allocated on the heap. No one would do
that. Would they?
Zan Lynx <zlynx at acm.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 189 bytes
Desc: This is a digitally signed message part
More information about the LUG