[Gc] Can sigaltstack be used in a GC registered thread?

Petter Urkedal urkedal at nbi.dk
Mon May 21 00:17:10 PDT 2012

On 2012-05-21, Boehm, Hans wrote:
> AFAIK, the collector makes no attempt to handle a stack overflow.  It does make an attempt to invoke a preexisting SIGSEGV handler if one was previously installed.  It's conceivably possible, though no doubt untested, to install a stack overflow handler that somehow maps additional stack space and returns.  I can't think of another approach that would work with the current code structure.  And I believe this is a common problem for lots of system libraries.  I believe you're also out of luck if you generate a stack overflow while calling the libc malloc.

For some purposes, it's sufficient to be able to longjmp back to a good
point or raise an exception.  E.g. I used libgc for a theorem prover
(unpublished), and while running though the TPTP suite, it would
occasionally cause a stack overflow, which I "handled" by skipping to
the next problem.  The signal stack handler I used is here:
https://github.com/paurkedal/culibs/blob/master/cuflow/errors.c (Note: I
should be calling the existing handler at the bottom of segv_handler.)

More information about the Gc mailing list