title: Will the stack of a C program ever shrink?
body: <p>I've noticed that every running C program has a private mapping called [stack] that is initially quite small (128k on my machine), but will grow to accomodate any automatic variables (up to the stack size limit). I assume this is where the call stack of my program is located.</p>
  
  <p>However, it doesn't seem to ever shrink back to its original size. Is there any way to free up that memory without terminating the process?</p>
  
  <p>How is the C stack implemented internally; what increases the size of the [stack] mapping on demand? Some compiler generated code, the C library or the operating system? Where is the increase triggered?</p>
  
  <p><em>Update</em>: I'm using Linux 3.0.0, gcc 4.6.1 and glibc6 on x86-64; as this is probably pretty implementation specific, any information on how it works there would be fine.</p>