Stack size in linux

Im just wondering how this affects programs writtin in c or c++. When i run ulimit -a on a linux system i see that my default stack size is 10240. How does this effect my programs? meaning if i a create a stack based object of a size bigger then 10240 what should happen? Does that setting indicate how much space a application has? How does the stack work in a c or c++ app? any good references would be nice. Thanks
closed account (S6k9GNh0)
It means that if you ever get stack overflow, you need to stop coding in C++ or learn about memory management.
That's 10240K I believe.

The kernel will allow your stack to grow to that size and no more. If you attempt to allocate more stack space than that, you will seg fault as soon as you access the data that is beyond the 10240K limit.

This is a per-process limit.
I think you'd better to read some documents about "program image" in memory. Then you will be

know

which part is the code area

which part is the static data

which part is the stack area

which part is the heap area

and how the stack and the heap increase.
Thanks for the information.
Topic archived. No new replies allowed.