结束线程的时候需要调用free释放内存吗?

honestman 2001-09-24 08:43:21
我create的一个线程,在
ThreadsObjects[i].Terminate;
ThreadsObjects[i].Resume;
后Execute结束,还需要调用free吗???
...全文
192 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
honestman 2001-09-24
  • 打赏
  • 举报
回复
现在终于好了!
honestman 2001-09-24
  • 打赏
  • 举报
回复
怎么我现在管理不了这帖子啊?
想发分都不行。
真TMD。
wilddragon 2001-09-24
  • 打赏
  • 举报
回复
好睡了
qiandeng 2001-09-24
  • 打赏
  • 举报
回复
自己可以设置
sweihua 2001-09-24
  • 打赏
  • 举报
回复
肯定是木马~!
wilddragon 2001-09-24
  • 打赏
  • 举报
回复
up
happybachelor 2001-09-24
  • 打赏
  • 举报
回复
自己好好看一看帮助吧!我也不懂!:)
Use Free to destroy an object. Free automatically calls the destructor if the object reference is not nil. Any object instantiated at runtime that does not have an Owner should be destroyed by a call to Free, so that can be properly destroyed and the memory released. Unlike Destroy, Free is successful even if the object is nil, so if the object was never initialized, Free won抰 result in an error.

When you call Free for a component, it calls Free for all components that it owns, that is, all components in its component list. A form owns all the controls and non-visual components that are created on it in design mode. When it is freed, all of these components are automatically freed as well. Since, by default, all forms are owned by the Application object, when the application terminates, it frees the Application object, which frees all forms. For all objects that are not components, or for components created with a nil owner, be sure to call Free after you are finished with the object; otherwise the allocated memory will not be usable until after the application terminates.

Warning: Never explicitly free a component within one of its own event handlers or free a component from the event handler of a component it owns or contains. For example, don抰 free a button in its OnClick event handler or free the form that owns the button from the button's OnClick event.

To free a form, call its Release method, which destroys the form and releases the memory allocated for it after all its event handlers and those of the components it contains are through executing.
zds0707 2001-09-24
  • 打赏
  • 举报
回复
FreeOnTerminate := true ;
则后Execute结束,线程自己free
否则...
honestman 2001-09-24
  • 打赏
  • 举报
回复
可以怎样设置???
zds0707 2001-09-24
  • 打赏
  • 举报
回复
看你的设置

5,930

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧