bug-bison
[Top][All Lists]
Advanced

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

Re: Using alloca


From: Hans Aberg
Subject: Re: Using alloca
Date: Thu, 18 Jan 2001 15:09:11 +0100

At 12:16 +0100 1-01-18, Akim Demaille wrote:
>> I surmise that even if the OS knows how to enlarge the stack,
>> allocating large chunks with alloca might be slow, as the stack
>> then must be enlarged.
>
>I know no system where `allocating stack' involves real work, it
>usually just means increasing the frame pointer, i.e., it costs
>peanuts, just an addition.

One can also run out of stack space, a common thing for functional
languages, in which case one either must pick down the program or enlarge
the stack dynamically (the latter less common even on UNIX platforms, it
seems from the bug reports).

Primitive OS's like pre-MacOS X & pre-NT (I think), are doing what you
propose, merely changing the stack pointer, which usually causes the
program or the whole computer to bomb when one is running out of stack
space. So in order to avoid that one has to implement a stack check by hand
(which I did for the MacHugs).

As for Bison, I do not know how much stack space it needs: The problems
usually arise when one needs a lot of dynamic increases in stack space. If
Bison has an in advance known limit, one can make sure it gets enough stack
space at startup time.

  Hans Aberg





reply via email to

[Prev in Thread] Current Thread [Next in Thread]