您的位置:首页 > 移动开发 > Objective-C

Memory Management(Chapter 3 of Objective-C Phrasebook)

2011-02-26 21:52 302 查看
When you send an object an -autorelease message, it is added to the currently active NSAutoreleasePool instance. When this instance is destroyed, every object added to it is sent a -release message. The -autorelease message is a deferred -release message. You send it to an object when you no longer need a reference to it but something else might. This is a convention that is important to observe in your own classes. If someone creates an instance of one of your classes with a named constructor, he will expect not to have to release it. A typical named constructor would look something like the one at the start of this section.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: