release只有等所有form的events都执行完毕之后才会destroy, free则不等待。 Destroys the form and frees its associated memory.procedure Release; 这是delphi的Help DescriptionUse Release to destroy the form and free its associated memory.Release is much like the Free method except that Release does not destroy the form until all event handlers of the form and event handlers of components on the form have finished executing. Any event handlers of the form should use Release instead of Free. Failing to do so could lead to an access violation.
Freeandnil(xxx); 功能和release相当
Freeandnil(xxx); 功能和release相当 是真的吗???
FreeAndNil跟Release无关 你可以看他的代码 procedure FreeAndNil(var Obj); var Temp: TObject; begin Temp := TObject(Obj); Pointer(Obj) := nil; Temp.Free; end;他就是free然后将指针置空Release是处理窗体的所有消息然后Free,所以释放窗体用Release更安全
free则不等待。
Destroys the form and frees its associated memory.procedure Release;
这是delphi的Help
DescriptionUse Release to destroy the form and free its associated memory.Release is much like the Free method except that Release does not destroy the form until all event handlers of the form and event handlers of components on the form have finished executing. Any event handlers of the form should use Release instead of Free. Failing to do so could lead to an access violation.
功能和release相当
功能和release相当
是真的吗???
你可以看他的代码
procedure FreeAndNil(var Obj);
var
Temp: TObject;
begin
Temp := TObject(Obj);
Pointer(Obj) := nil;
Temp.Free;
end;他就是free然后将指针置空Release是处理窗体的所有消息然后Free,所以释放窗体用Release更安全