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:

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

Are you still seeing an AV?

Marcos Douglas
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org

Reply via email to