1

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.

1

3 Answers 3

2

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.

Sign up to request clarification or add additional context in comments.

Comments

1

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

4 Comments

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.
can't C on UNIX / Solaris also have a stack size limited only by the physical memory?
I recall C had/has a stack segment size that is a kernel param
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.
0

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...

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.