我知道(在包括这个 SO 答案DisposeOf
在内的许多地方都有描述)释放表单,但将其视为一种黑客行为。据我了解,它将对象置于状态,并且可能不会将其完全从内存中删除。Zombie
正确的方法是识别并删除对表单的所有引用。但是尝试这样做,我找不到一个参考。这是我的代码:
var MyForm: TMyForm;
...
//Dynamically create the form
MyForm := TMyForm.Create(Application)
...
//Destroy the form to free up memory
Application.RemoveComponent(MyForm);//reduces RefCount from 4 to 2
if MyForm.RefCount=1 then //RefCount is 2 here
MyForm := nil
else
ShowMessage('Cannot release MyForm: RefCount='+inttostr(MyForm.RefCount));
我使用 Delphi 10 Seattle,并针对 iOS 9.0 的 iPad。
我在哪里可以找到对表格的最后引用?