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

Tony Whyman tony.whyman at mccallumwhyman.com
Fri Oct 7 16:20:17 CEST 2016

On 07/10/16 12:29, stdreamer wrote:
> No! Delegation is a mechanism, when used, you have to know exactly how 
> it works. Delegation is only used to minimize code instead of writing 
> a bunch of procedures that call the contained object's methods. That's 
> it and nothing more.

I believe that I now understand the issues around interface delegation 
and how to use it. You are correct, it's only an optimisation - and it 
sucks. I would never recommend anyone to use interface delegation as you 
have to only put a "foot wrong" and can end up memory leaks on one side, 
or access violations on the other. Writing a "bunch of procedures" may 
be tedious but it's less work in the end.

More information about the fpc-pascal mailing list