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

stdreamer stdreamer at freemail.gr
Fri Oct 7 12:08:01 CEST 2016

On 07/10/2016 12:49 μμ, Tony Whyman wrote:
> You seem to be playing around with words. Perhaps I am guilty of sloppy
> English when I say "interface is copied" when meaning "an interface
> reference is copied". However, this does not change the underlying problem.
> The problem being referred to is the functionality described here:
> http://freepascal.org/docs-html/current/ref/refse44.html#x98-1200007.4
> under the title "Interface delegation". The word "contained" does not
> appear here.

As it should, contained interfaces are one way to solve the problem 
there are other ways that are design/domain specific and yet again there 
is the option(already given here) to use interface variables instead of 
object variables, just make sure you set them to null on the destructor 
to release the interface.

I see no rabbit hole or any other problem in the code posted so far 
except perhaps lack of proper clean up which might be intentional.

More information about the fpc-pascal mailing list