On Fri, Sep 12, 2003 at 11:12:25 +0200, Guennadi Liakhovetski wrote: > Hello > > IIRC, user-space application stack can grow dynamically, right? Now, if > this is so, what happens in ENOMEM? Say, in a function, I can either > explicitly malloc(), or I can have a local char buf[...]. Will the app > just sleep "forever" waiting for RAM to become available? The stack is mapped in process address space from start. But being mapped does not mean being mapped somewhere. When it's first accessed, kernel tries to get a free page. If it fails to get one, it kills the process with KILL signal (there is no other way -- to many processes have been promissed memory). By the way the same can happen with ordinary allocations (IIRC only setbrk can lead to this -- malloc sometimes uses setbrk and sometimes mmap). ------------------------------------------------------------------------------- Jan 'Bulb' Hudec <bulb@ucw.cz> -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/