distal-attribute
distal-attribute
distal-attribute
distal-attribute

Why not Free the dialog right now after use?

User, date Message
Written by pizza111
8 months ago
Category: General
19 posts since Fri, 01 Nov 13
procedure TMainForm.actSessionManagerExecute(Sender: TObject);
var
Dialog: TConnForm;
begin
Dialog := TConnForm.Create(Self);
Dialog.ShowModal;
// Dialog.Free; // Why not???
end;


procedure TMainForm.actImportCSVExecute(Sender: TObject);
var
Dialog: Tloaddataform;
begin
// Import Textfile
Dialog := Tloaddataform.Create(Self);
Dialog.ShowModal;
end;

---------------------------
Sir, you tool is very good. But sometimes(not little times), it is crashed. So I try to read your code, and I find that you don't free the dialog right now. I think "TConnForm.Create(Self);" means the instance of TConnForm is managed automatically by MainForm and will be free even you have really lost this instance. But why not free the instance right now? It is so easy.
Written by BubikolRamios
7 months ago
327 posts since Thu, 14 Jan 10
I think he is aware of programers mantra: "do not repair something that works" (-:

Itherway I remember from head there are also commands like FreeAndNil
that does magic, and only way to confirm (unleas having special tools for looking for memory leaks) that it did what it should is monitoring task manager looking at mem usage.

Time consuming.

 

Please login to leave a reply, or register at first.