[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MiNT] stack size!



On Mon, Feb 01, 1999 at 11:35:07AM +0100, Andreas Schwab wrote:
> stehlik@cas3.zlin.vutbr.cz (Petr Stehlik) writes:
> 
> |> I would love to know how to determine the stack size
> 
> That's impossible to predict in general (equivalent to the halting
> problem).  What you could do is look through the sources and find the
> places where big arrays are locally allocated, or calls to alloca().

I think it's faster and safer to just go try and error.  The problem
is that you cannot generally foresee the required stack size, it is
not only a compile-time but also a run-time problem.  As far as I
can see it, the stack requirements of for example sed depends on the
usage.  If you feed it a very complicated, deeply nested regular 
expression it will need a much larger stack than while using it with
only simple regex.  For compilers the stack requirements will probably
depend on the degree of optimisation and the complexity of the
sources.

Consequence:  Find a reasonable stack size and temporarily resize
it for particular tasks.  You also have to bear in mind that this
is really a trade-off between stability and memory consumption (a 2 meg
stack will consume 2 megs of ram).

Ciao

Guido
-- 
http://stud.uni-sb.de/~gufl0000/
mailto:gufl0000@stud.uni-sb.de