[fpc-pascal] Free Pascal 3.0.4-rc1 released!

Graeme Geldenhuys mailinglists at geldenhuys.co.uk
Wed Sep 6 10:32:23 CEST 2017


On 2017-09-06 09:19, Graeme Geldenhuys wrote:
> For example:
> 
> 
> ****** Compiled with FPC 3.0.2 or FPC 3.0.4 - no line info


The complete sample application is here:


=======================[ project1.pas ]============================
program project1;

{$mode objfpc}{$H+}
{$interfaces COM}

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;

type
    TBaseClass = class(TInterfacedObject, IHook)
    private
      FHook: IHook;
      property Hook: IHook read FHook implements IHook;
    public
      constructor Create;
      destructor Destroy; override;
    end;

    constructor TBaseClass.Create;
    begin
      FHook := THook.Create;  // FPC 2.6.4 reports a memory leak here
    end;

    destructor TBaseClass.Destroy;
    begin
      // nothing to do here
    end;


var
    base: IHook;

begin
    base := TBaseClass.Create;
    base.DoIt;
    base := nil; // just to see if it helped with the memory leak - it
doesn't

end.
==============================[ end ]==============================


Regards,
   Graeme

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

My public PGP key:  http://tinyurl.com/graeme-pgp



More information about the fpc-pascal mailing list