[fpc-devel] Why/how does the compiler have a non-trivial number ofmemory leaks after over two decades of development?

Michael Van Canneyt michael at freepascal.org
Mon Jul 30 15:30:00 CEST 2018



On Mon, 30 Jul 2018, Mattias Gaertner wrote:

> On Mon, 30 Jul 2018 14:36:10 +0200 (CEST)
> Michael Van Canneyt <michael at freepascal.org> wrote:
>
>> [...]
>> Many people will probably be surprised, but the use of try/finally 
>> is not required for an application:
>> 
>> Gradually, some parts of the compiler were switched to classes, but even
>> then, without exceptions: As long as you do not use the sysutils unit,
>> (which was the case for many years for the compiler) exceptions will 
>> not be raised, and so there is simply no need for try/finally blocks.
>
> Many people will probably surprised, that try/finally/except works
> without sysutils and try/except does not need "Exception". It
> works with any TObject.
>
>> Probably it would be better to remove the dependency on sysutils, to keep
>> the compiler free of try/finally blocks.
>
> Sysutils has nothing to do with creating exception frames.

It does: if you know the program will never raise exceptions, it makes no
sense to install try/finally blocks.

Runtime errors are converted to exceptions by the sysutils unit. 
By not including it, you know you will just get runtime errors, and hence
you don't need try..finally.

Obviously provided you don't install another mechanism that does this and
don't raise exceptions manually, which - AFAIK - is the case in the
compiler...

Michael.



More information about the fpc-devel mailing list