Is infinite recursion the only case or can it happen for other reasons? Doesn\'t the stack size grow as needed same as heap?
Sorry if this question has been asked be
If your program exceeds its alloted stack space without any infinite recursion going on, then you're doing something wrong.
Though it can happen if you leave off some asterisks and try to pass some huge buffers by value.
The memory allocated for the stack does generally grow as needed within reasonable boundaries - I'm not sure what the upper limit is on various systems.