ARC How the strong reference works
来源:互联网 发布:年轻的网络作家 编辑:程序博客网 时间:2024/06/05 00:34
How the strong reference works
id __strong obj0 = [[NSObject alloc] init];
/*
* obj0 has a strong reference to object A*/
id __strong obj1 = [[NSObject alloc] init];
/*
* obj1 has a strong reference to object B*/
id __strong obj2 = nil;
/*
* obj2 has no reference*/
obj0 = obj1;
/*
*Obj0 has a strong reference to object B,
* So, obj0 does not have a strong reference to object A anymore.
* Object A is disposed of because no one has ownership of it.
* At this moment, both obj0 and obj1 have strong references to object B.
*/
obj2 = obj0;
/*
* Through obj0, obj2 has a strong reference to object B.
*
* At this moment, obj0, obj1 and obj2 have strong references to object B.
*/
obj1 = nil;
/*
* Because nil is assigned to obj1, strong references to object B disappear.
* At this moment, obj0, and obj2 have strong references to object B.
*/
obj0 = nil;
/*
* Because nil is assigned to obj0, strong references to object B disappear.
* At this moment, obj2 have strong references to object B.
obj2 = nil;
/*
* Because nil is assigned to obj2, strong references to object B disappear.
* Object B is disposed of because no one has ownership of it
- ARC How the strong reference works
- How PHP Reference works?
- How The Computer Works
- How the Computer Works
- How the Internet works
- How the Web Works
- The Basics: How Programming Works
- How The Immediate Attribute Works
- How the Scientific Method Works
- How the PCI bus works
- How the ECDSA algorithm works
- How the buffer cache works
- How the Main Thread works
- How the backpropagation algorithm works
- [转]、How TCP IP works,How does the Internet Work,How the DNS works
- How the Linux Kernel initcall Mechanism Works
- How the web-tier compiler works
- How the Best Path Algorithm Works
- IOS开发-object-c之 @[], @{}
- 对于(function(){}())和function(){}实例的作用域分析(里面有很多问题……)
- Python 知识整理
- 售价高达2500美元的播放器Astell&Kern AK240你知道吗?
- mysql中order by优化的那些事儿
- ARC How the strong reference works
- generator自动生成mybatis配置和类信息
- Nutch 一般工作流程
- HDU 1712 ACboy needs your help (分组背包)
- 算法题
- IE和FireFox中JS兼容之event .
- 虚函数的的原理及应用
- 如何快速学好terraexplorer pro二次开发
- HDU 1159 Common Subsequence