From: Kim Barrett (kab_at_[hidden])
Date: 2006-03-11 12:06:15
At 8:46 AM +0100 3/11/06, =?UTF-8?B?SW9uIEdhenRhw7FhZ2E=?= wrote:
>Although ugly, a function to erase all named objects is an option. You
>can catch UNIX signals like SIGSEGV and call a function to release all
>reference counts, after that, abort the program. I would need to
>register every named object in a global list and the
>destroy_all_named_before_abort() would destroy every object. After that
>you can exit.
Too late! Once SIGSEGV arrives, all bets are off. One might sometimes get
lucky and be able to run that cleanup code, but that's highly unreliable.
There are situations where it might make sense to *try* to run code after
a SIGSEGV (boost.test can do this, with the rationale that some attempt
at writing out information is better than just giving up immediately),
but that's not good enough for a robust reference count.
And as has already been pointed out, this approach doesn't help at all
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk