标签: clx

FastMM报告在FormDestroy上释放的类上的内存泄漏

我遇到了Delphi 7应用程序(CLX)的内存泄漏问题,其代码如下:

unit Unit2;

interface

  uses ECRClass, ECR_Text,  SysUtils, Types, Classes, Variants, Math;

  type tLeakClass = class
  private
  fsType : integer;

  public
  fsPrinter : TECR_Class;

  published
  constructor Create (AOwner : TComponent);
  destructor Destroy();
  end;


implementation

   constructor tLeakClass.Create (AOwner : TComponent);
   begin
   fsPrinter := TECR_Text.Create(AOwner);
   end;

   destructor tLeakClass.Destroy();
   begin
     fsPrinter.Free
   end;

end.
Run Code Online (Sandbox Code Playgroud)

fsPrinter即使在主窗体(TForm)关闭时释放它,对象结果也会泄露:

unit Unit1;

interface

uses
  SysUtils, Types, Classes, Variants, QTypes, QGraphics, QControls, QForms, 
  QDialogs, QStdCtrls, Unit2;

type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
    procedure FormDestroy(Sender: TObject); …
Run Code Online (Sandbox Code Playgroud)

delphi memory-leaks delphi-7 kylix clx

3
推荐指数
1
解决办法
377
查看次数

标签 统计

clx ×1

delphi ×1

delphi-7 ×1

kylix ×1

memory-leaks ×1