On Sat, Jan 29, 2005 at 05:18:59PM +0100, A. Pagaltzis wrote:
> * Dave Mitchell via RT <[EMAIL PROTECTED]> [2005-01-29 16:40]:
> > I can't really see what else Perl can do. The segfault happens
> > when Perl extends the stack too far. This can't be avoided.
> 
> Isn't it possible to check before extending the stack whether
> there's room for the planned extension?

No. we're talking about the processor stack here, not the Perl stack. That
would imply that every function call that perl ever makes (and in any
libraries that is uses) must check first, which would grind things to a
halt. Also, I don't believe there is a portable way of determining the
current stack allocation.

> > The SIGSEGV could be caught, but then there's nothing sensible
> > that perl could then do to retrieve the situation.
> 
> As I said I don't think there is much that perl could do to
> salvage the running program; but if possible it should at least
> throw an error along the lines of "Deep recursion in regex in
> file foo.pl line 42" and, ideally, proceed to die in an orderly
> manner (global destruction and all that).

No, because by the time of a SIGSEGV, perl can't execute any code that
might call a function, because it hasn't got a stack.

-- 
Thank God I'm an atheist.....

Reply via email to