develooper Front page | perl.perl5.porters | Postings from January 2001

Re: Does perl really need to use sigsetjmp? (18% performance hit)

Thread Previous | Thread Next
From:
Alan Burlison
Date:
January 20, 2001 11:39
Subject:
Re: Does perl really need to use sigsetjmp? (18% performance hit)
Message ID:
3A69E949.7E77943A@uk.sun.com
Nicholas Clark wrote:

> If so, were we intending to use the same idea in perl6? Because it worries
> me that with the setjmp()/longjmp() system anything like:
> 
> myfunc {
>   foo = malloc(something);
>   some_other_func(...);
>   free(foo);
> }
> 
> will leak resources if some_other_func (or any of its descendants) jumps
> past us. At least with C++, throwing exceptions calls destructors on the way
> past each stack frame.

Only if the exception is caught.  The C++ standard doesn't specify if
the stack should be unwound for uncaught exceptions.  In the words of
the standard 'it is implementation dependent'.  Hah!  C++ - what a
crock.

> Or have I missed something?

Nope.  In addition sigsetjmp/setjmp is not MT-safe, so it shouldn't be
used anyway in threaded perl.

Alan Burlison

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About