[fpc-pascal] Generic way to pre-maturely exit TCustomApplication without memory leaks

Santiago A. svaa at ciberpiula.net
Thu Oct 13 11:22:31 CEST 2016

El 13/10/2016 a las 10:09, Graeme Geldenhuys escribió:
> I would also rewrite that with a try..finally as in:
> ph := TH.Create(nil)
> try
>   ph.Initialize;
>   ph.ProcessOptions;
>   ph.Run;
> finally
>   ph.Free;
> end;
May be I'm wrong, but I think that Halt(n) is a nuclear bomb, it closes
the application almost on the current instruction, "finally" and
"except" blocks are not executed. Nevertheless, Finalization blocks are

Anyway, I think that when the application is closed all the allocated
memory is freed, memory leaks survive as long as the application is
running. So wondering about what's in memory after a halt makes no
sense, everything is freed.

Santiago A.

More information about the fpc-pascal mailing list