自动释放池可以创建无限多个;无限嵌套创建

在内存中使用栈数据结构来存储释放池,先进后出;    

oc-autorelease

oc-autorelease

调用了alloc 就必须调用release 或者autorelease
一次alloc 对应一次release 或者autorelease
不能对应多次
 
野指针错误:
oc-autorelease
oc-autorelease
 
释放池的老式写法;已淘汰
oc-autorelease
 
 
封装 对象的autorelease方法 节省代码量
 
创建对象类
 
oc-autorelease
调用系统方法或者第三方方法,只要方法中没有alloc等,就不需要进行release;
 
oc-autorelease
错误:
oc-autorelease
 
修改 personWithAge 方法 谁调用就返回谁 一个方法返回不同的对象
避免在子类中重写父类的方法;
oc-autorelease
 
 
 
 
 
 

相关文章: