[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 14:36:10 CEST 2018



On Mon, 30 Jul 2018, Marcos Douglas B. Santos wrote:

> On Mon, Jul 30, 2018 at 9:14 AM, Sven Barth via fpc-devel <
> fpc-devel at lists.freepascal.org> wrote:
>
>> J. Gareth Moreton <gareth at moreton-family.com> schrieb am Mo., 30. Juli
>> 2018, 13:31:
>>
>>> I've noticed that the compiler doesn't use
>>> try...finally blocks to help with freeing
>>> blocks. I'm not sure why this is the case,
>>> but might be speed related.
>>>
>>
>> Correct. Even implicit try-finally frame generation is disabled for the
>> compiler source.
>>
>
> Is performance more important than being correct?  :|

You've been around long enough to know that complaints about 
the speed of the compiler is something that pops up on a regular basis.

Also, and this is important: the compiler was developed for TP.
It had no concept of exceptions. Everything was done using records and
pointers.

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.

Probably it would be better to remove the dependency on sysutils, to keep
the compiler free of try/finally blocks.

But the compiler devs will be able to provide a more correct&detailed picture than
this.

Michael.



More information about the fpc-devel mailing list