Re: About stack size

From: Niklas Borson (niklasb_at_microsoft.com)
Date: 09/10/04


Date: 10 Sep 2004 01:54:13 -0700

Alwyn <dt015a1979@mac.com.invalid> wrote in message news:<100920040103254378%dt015a1979@mac.com.invalid>...
> In article <DN50d.18192$rm1.3153@newssvr29.news.prodigy.com>, Sam
> Sungshik Kong <ssk@chol.nospam.net> wrote:
> >
> > > Typically, the stack grows downwards from high memory and the heap
> > > grows upwards. You get stack overflow if the stack encroaches on the
> > > heap area.
> >
> > This is interesting.
> > I remember that I've seen an example program which shows static, stack, and
> > heap variables using there addresses.
> > IIRC, stack variables were placed on lower memory than heap.
> > But experiences are not very reliable.
>
> It depends on the platform, but most of them are like this:
> <http://lambda.uta.edu/cse5317/fall02/notes/node30.html>

I doubt "most" of them are like that any more. Consider a process
with multiple threads, all sharing the same address space. Each
thread will typically have its own stack. (Actually, under Windows
there are two stacks for each thread, IIRC, one for user mode and
one for kernel mode.)