[fpc-pascal] sqldb create/free lifetime of object

Sven Barth pascaldragon at googlemail.com
Wed Apr 12 17:14:56 CEST 2017

Am 12.04.2017 14:32 schrieb <noreply at z505.com>:
> In a way, this is a form of garbage collection or RAII sort of. And
reduces the obnoxious free's required in non garbage collected programming
languages... So it's a nice feature/trick to have ownership. But at the
same time you can think there is a memory leak since there is no
create/free pair easily visible...
> So you train your eyes to look for ownership.
> And similarly, delphi gui widgets you throw onto a form, don't need to be
freed yourself, even though the program created them - so in a way delphi
TForm's gui widgets are also garbage collected, sort of. Again a nice
feature/trick to avoid all the obnoxious free calls that bloat up the
source code with line noise.

Both are in fact using the same mechanism as you can put e.g. a
TSQLTransaction on a form as well.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20170412/d5e359c2/attachment.html>

More information about the fpc-pascal mailing list