Autor Beitrag
wolke
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 240



BeitragVerfasst: Mo 06.02.06 01:21 
laut FastMM4 erzeugt folgender code ein 12 byte speicherleck:

ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
type
  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

  TTest = class(TThread)
  published
        procedure Execute; override;
  public
        constructor Create;
        destructor Destroy; override;
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

var Test: TTest;

procedure TForm1.FormCreate(Sender: TObject);
begin
 Test:=TTest.Create;
end;

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
 Test.Free;
end;

procedure TTest.Execute;
begin
end;

constructor TTest.Create;
begin
 inherited Create(true);
end;

destructor TTest.Destroy;
begin
 inherited Destroy;
end;


wieso?! was ist daran falsch?
nicht über sinn und unsinn wundern, ich habe nur gerade das selbe problem mit einem 'wirklichen' tthread. dort werden es allerdings pro durchlauf 12byte mehr...
Knulli
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 116
Erhaltene Danke: 2

Win2k, Win7, Win10
D5, D2005, D2006, D2007, D10.4.2
BeitragVerfasst: Do 09.02.06 13:12 
Versuch mal FreeAndNil(Test) in FormClose (besser FormDestroy)
Knut
Motzi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2931

XP Prof, Vista Business
D6, D2k5-D2k7 je Prof
BeitragVerfasst: Do 09.02.06 14:15 
Lass mal die zusätzliche Thread-Klasse komplett weg (also im Prinzip ein ganz leeres Projekt). Bleibt das Speicherleck trotzdem bestehen?

_________________
gringo pussy cats - eef i see you i will pull your tail out by eets roots!