谁负责释放iOS中Singleton类的内存?
我正在检查如何在 iOS 上编写 Singleton 类。根据网站(http://www.galloway.me.uk/tutorials/ singleton-classes/),我知道如果不使用 ARC,我需要使用 allocWithZone 函数来分配我的类本身。
我的关键问题是...稍后如何释放我的类的内存(在 alloc 或 allocWithZone 之后)?谁对记忆负责?
谢谢。
I am checking on how to write Singleton class on iOS. According to the web site (http://www.galloway.me.uk/tutorials/singleton-classes/), I understand that without the use of ARC, I need to use allocWithZone function to allocate my class itself.
My key question is ... how can the memory of my class (after alloc or allocWithZone) be freed later ? Who is responsible for the memory ?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果你想在
-(id) init
期间“释放内存”,你可以设置self = nil;
if you want to "free the memory" during
-(id) init
you can setself = nil;