No handling for uncaught exceptions
Original Reporter info from Mantis: Simon Ameis @SAmeis
-
Reporter name: Simon Ameis
Original Reporter info from Mantis: Simon Ameis @SAmeis
- Reporter name: Simon Ameis
Description:
FPC 2.7.1 revsion 25252 doesn't handle uncought exceptions by default. This results in a memory leak for all uncaught exceptions if it isn't done by user code. Version 2.6.2 handles uncaught exceptions and prints the usual message ("An unhandled exception occurred at ..."); no memory leaks.
Steps to reproduce:
Compile this with fpc 2.7.1 and run it. You should enable heaptrc and line information in compiler settings.
program Project1; {$MODE OBJFPC} uses sysutils; begin try raise Exception.Create('Exception not freed?'); finally writeln('finally'); readln; end; end.
Example output is:
finally An unhandled exception occurred at $0000812C: Exception: Exception not freed? $0000812C main, line 7 of C:/Users/simon/AppData/Local/Temp/project1.lpr Heap dump by heaptrc unit 10 memory blocks allocated : 949/968 7 memory blocks freed : 878/888 3 unfreed memory blocks : 71 True heap size : 393216 True free heap : 392912 Should be : 392944 Call trace for block $B6F9C1E0 size 24 $00008064 $0004D380 EXCEPTION__CREATEFMT, line 214 of C:/FPC/trunk-src/rtl/objpas/sysutils/sysutils.inc $00008158 main, line 8 of C:/Users/simon/AppData/Local/Temp/project1.lpr $00008064 Call trace for block $B6F94060 size 35 $0003B004 FORMAT, line 381 of C:/FPC/trunk-src/rtl/objpas/sysutils/sysformt.inc $0003B6E4 FORMAT, line 924 of C:/FPC/trunk-src/rtl/objpas/sysutils/sysstr.inc $0004D380 EXCEPTION__CREATEFMT, line 214 of C:/FPC/trunk-src/rtl/objpas/sysutils/sysutils.inc $00008158 main, line 8 of C:/Users/simon/AppData/Local/Temp/project1.lpr $00008064 Call trace for block $B6F9C180 size 12 $00008158 main, line 8 of C:/Users/simon/AppData/Local/Temp/project1.lpr $00008064
Mantis conversion info:
- Mantis ID: 24864
- Build: 25252
- Version: 2.7.1