On Sun, Mar 11, 2018 at 11:17 AM, Vojtěch Čihák <[hidden email]> 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