mirror of
https://github.com/NohamR/knowledge-kit.git
synced 2026-05-24 20:00:37 +00:00
docs: 年度总结
This commit is contained in:
@@ -1961,9 +1961,9 @@ static inline id *autoreleaseFast(id obj) {
|
||||
|
||||
### autorelease 对象什么时候调用 release 方法
|
||||
|
||||
每当进行一次`objc_autoreleasePoolPush`调用时,runtime向当前的AutoreleasePoolPage中add进一个`哨兵对象`,值为0(也就是个nil),那么这一个page就变成了下面的样子:
|
||||
每当进行一次`objc_autoreleasePoolPush`调用时,runtime 向当前的 AutoreleasePoolPage 中 add 进一个`哨兵对象`,值为0(也就是个nil),那么这一个page就变成了下面的样子:
|
||||
|
||||

|
||||

|
||||
|
||||
`objc_autoreleasePoolPush`的返回值正是这个哨兵对象的地址,被`objc_autoreleasePoolPop(哨兵对象)`作为入参,于是:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user