Clean up exception stack on unhandled exception
Original Reporter info from Mantis: runewalsh
-
Reporter name:
Original Reporter info from Mantis: runewalsh
- Reporter name:
Description:
In answer to unhandled exception RTL calls ExitProc and then Halt().
It does not bother to free the exception stack data, including stack nodes themselves or exception objects owned by them.
Halt() calls unit finalizers. This may include heaptrc finalizer.
The thing is, user may want to check for leaks even in those circumstances: such a leak may reveal a bug inside one of the “finally” blocks, for example.
So, I think that it will be nice for RTL to clean them up.
Steps to reproduce:
// compile with -gh (heaptrc unit)
uses
SysUtils;
begin
try
raise Exception.Create('leak one');
finally
try
raise Exception.Create('leak two');
finally
raise Exception.Create('leak three');
end;
end;
end.
Mantis conversion info:
- Mantis ID: 37862
- Monitored by: » @MageSlayer (Denis Golovan)