No destructors for automatic objects are called. If replacing of longjmp with throw and setjmp with catch would execute a non-trivial destructor for any automatic object, the behavior of such longjmp is undefined.Your suggestion to croak outside the catch block worked! I actually don't even need a goto; I can just capture the exception message in a string, let the catch block exit normally, then croak with the captured message like so:
From http://en.cppreference.com/w/c/program/longjmp
void
Foo::bar()
CODE:
const char* error = 0;
try {
THIS->bar();
}
catch (const std::runtime_error &e) {
error = e.what();
}
if (error != 0) {
croak(error);
}
In reply to Re^2: Memory leak in XS code that handles C++ exceptions
by slower
in thread Memory leak in XS code that handles C++ exceptions
by slower
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |