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

Sven Barth pascaldragon at googlemail.com
Wed Sep 6 17:20:58 CEST 2017


Am 06.09.2017 17:03 schrieb "Ryan Joseph" <ryan at thealchemistguild.com>:
>
>
> > On Sep 6, 2017, at 8:03 PM, Graeme Geldenhuys <
mailinglists at geldenhuys.co.uk> wrote:
> >
> > I couldn't call .Free because FHook was a interface reference type of
type IHook, not THook.
>
> But TInterfacedObject is a class isn’t it? Then you call FHook :=
THook.Create; so a I’d expect a Free(). What am I missing?
>
> type
>  THook = class(TInterfacedObject, IHook)
>  private
>    procedure DoIt;
>  end;

You're missing that FHook was declared as IHook, not THook.

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


More information about the fpc-pascal mailing list