[fpc-pascal] Managed record questions

Sven Barth pascaldragon at googlemail.com
Thu Mar 8 11:42:40 CET 2018


Am 08.03.2018 09:44 schrieb "Ryan Joseph" <ryan at thealchemistguild.com>:

2) We need to remember to call Free() at the end of the function and take
precaution to not exit early and leak memory (maybe even using a goto to
break out of nested loops or nested functions, who knows).


You are supposed to use try...finally for this. The finally-block is always
executed when the try-block is left no matter if it's by reaching the end,
calling exit or by an exception.

Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20180308/b96d1ceb/attachment.html>


More information about the fpc-pascal mailing list