Re: Testing Program Question
On 2 Mar, 23:55, "Leigh Johnston" <le...@i42.co.uk> wrote:
Stack size is not usually deterministic, at least not in a
single threaded program. In practice, stack size depends on the
current setting of ulimits, how much virtual memory is
available, and how much of that is being used by other
processes.
In a single threaded program the maximum stack size is usually
a linker setting. Stack size *is* *usually* deterministic.
How many different platforms do you know? I've worked on quite
a few, and I'm only aware of two where stack size is set at link
time: Windows and HP/UX. On most systems (at least since the
PDP-11), in a single threaded program, stack size is more or
less open, and determined at runtime: the code goes at the
bottom, followed by the static data, and the start of the heap,
which grows up; the stack goes at the top, and grows down. And
you run out of stack when the two meet. Except that on a
modern, 64 bit machine, you'll run out of virtual memory a lot
earlier.
--
James Kanze