On Sun, Mar 11, 2018 at 11:17 AM, Vojtěch Čihák <vojtech.ci...@atlas.cz> wrote:
> Yes, TBar is TInterfacedObject and is reference counted therefore Free is
> not needed.
>
> Just comment the line //Bar.Free; compile with -gh and you will see no
> memory leak.

You think this is the problem...
All right, try to change your copy like this:

===begin===
  Bar := TBar.Create;
  try
    if Supports(Bar, IBar) then
      Writeln(Bar.Name + ' supports...');
  finally
    ////Bar.Free;  << no Free
  end;
===end===

Are you still seeing an AV?

Marcos Douglas
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to