[fpc-pascal] A serious Memleak using delegates/implements (was: Delegate Interface class does not seem to be referenced counted)

Martin Schreiber mse00000 at gmail.com
Thu Oct 6 06:54:35 CEST 2016

On Thursday 06 October 2016 00:16:22 Tony Whyman wrote:
> On 05/10/16 23:03, Graeme Geldenhuys wrote:
> > Martin Schreiber recently mentioned in another Interface discussion that
> > there is a very good reason he doesn’t use COM style interfaces…
> > Reference Counting!
> Used properly reference counted interfaces are very powerful and allow
> for some very elegant programming. Do you complain about AnsiStrings?
> They are reference counted. Would you really want to have to free every
> string explicitly? Dynamic arrays are similarly reference counted.
Reference counting is great for simple types like strings and dynamic arrays 
but is a nightmare with the venturesome mixture of COM-interface and classes 
from Delphi. Even reference counting for complex classes is no good idea IMO, 
I fear the times when FPC will implement ARC.
I don't think that a programming language should hide more and more of the 
internal working of the code he writes from the programmer. Take a look at 
the modern C++ programs; the LLVM-compiler is a good example. It is horrific 
slow. Stepping through the code shows that there are complex multi-level 
dynamic type conversion and dataaccess routines at almost every statement. 
The typical C++ programmer does not need to care about because the 
programming language takes care for the boring tasks. The typical C++ 
programmer actually *does* not care about performance because competing 
programs are not faster; they are written in a modern programming language 
Recently I had to revive my stone old AMD-K6 PC with Windows 95. What marvel, 
that relict with its age-old applications provides a better user experience, 
is snappier, more convenient and more productive than my newest Linux machine 
with the modern desktops and applications.


More information about the fpc-pascal mailing list