does some language or platform not have a fixed size of stack and therefore not easy to overflow? I remember using C on UNIX, the stack was difficult to overflow while back in the days of Win 3.1, the stack was very easy to overflow.
-
Similar question: http://stackoverflow.com/questions/53827/checking-available-stack-size-in-c – Igor Krivokon May 29 '09 at 04:58
3 Answers
If by "stack" you mean any old stack, most languages do-- Java has a stack class limited only by memory. More likely you mean the call stack, in which case the biggest example I can think of is Stackless Python, which, to my understanding, uses a pure-python memory-limited stack (like Java's) as the call stack for Python code, rather than using C's call stack.

- 92,913
- 4
- 55
- 79
this is a question of the practical vs the theoretical. the stack of a lisp interpreter is limited only by available memory
in scheme and other languages that implement tail recursion, a tail recursive function would have an infinite stack

- 20,098
- 9
- 30
- 27
-
A tail recursive function with the associated iterative optimization doesn't even go on the stack, as far as I know. If you define "stack" as related to calling functions, as an abstraction, that statement is true, but I wouldn't use that abstraction, since it's not particularly helpful. I didn't get the impression that that definition was normal, either. – Devin Jeanpierre May 29 '09 at 04:59
-
can't C on UNIX / Solaris also have a stack size limited only by the physical memory? – nonopolarity May 29 '09 at 05:02
-
-
Devin, good question about whether a tail recursive function would use a stack. I implemented a scheme interpreter and yes, there is a stack frame. The difference is in the return action, with a tail recursive function there is a tail-return which overwrites the existing frame, so the stack used by that function has only a single frame. – jottos May 29 '09 at 06:10
Mac Systems 6, 7, and 8 had call stacks that could grow without artificial limit.
It also has no guaranteed way to detect a stack--heap collision, and could get you into all kinds of trouble that way...

- 98,632
- 24
- 142
- 234