I have such code as follows
try {
doSomething();
} catch(InterruptException) {
goto rewind_code;
}
if(0) {
rewind_code:
longjmp(savepoint, 1);
}
My question is, is the exception object that is stored by the C++ runtime free'ed when I goto
out of the catch block? Or is the runtime allowed to cache it until the surrounding function exists or something like that? I simply want to ensure that if I execute above code multiple times, each time taking the rewind code, I won't leak memory (because the longjmp
won't execute cleanup code emitted by the compiler into or before function prologues).