为什么有的窗体可以调用release,有的则没有此过程。?

解决方案 »

  1.   

    UP一下。我也忘了。可能是创建方法不同,所以释放也不同吧。反正FREE更安全
      

  2.   

    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.
      

  3.   

    Freeandnil(xxx);
    功能和release相当
      

  4.   

    Freeandnil(xxx);
    功能和release相当
    是真的吗???
      

  5.   

    FreeAndNil跟Release无关
    你可以看他的代码
    procedure FreeAndNil(var Obj);
    var
      Temp: TObject;
    begin
      Temp := TObject(Obj);
      Pointer(Obj) := nil;
      Temp.Free;
    end;他就是free然后将指针置空Release是处理窗体的所有消息然后Free,所以释放窗体用Release更安全