[fpc-pascal] Where and Why is there a memory leak?

Sven Barth pascaldragon at googlemail.com
Wed Sep 6 11:41:40 CEST 2017


Am 06.09.2017 10:31 schrieb "Graeme Geldenhuys" <
mailinglists at geldenhuys.co.uk>:
> type
>   IHook = interface
>     ['{4BCAEDD8-92D8-11E7-88D3-C86000E37EB0}']
>     procedure DoIt;
>   end;
>
> type
>   THook = class(TInterfacedObject, IHook)
>   private
>     procedure DoIt;
>   end;
>
>   procedure THook.DoIt;
>   begin
>     writeln(ClassName + ' did it');
>   end;

I think THook needs to derive from TAggregatedObject, cause that couples
the reference counting to that of the controlling instance.
See here:
http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Implementing_Interfaces

Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20170906/fa88debc/attachment.html>


More information about the fpc-pascal mailing list