You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/** * This function stores a new value into a __weak variable. It would* be used anywhere a __weak variable is the target of an assignment.* * @param location The address of the weak pointer itself* @param obj The new object this weak ptr should now point to* * @return The value stored into \e location, i.e. \e obj*/OBJC_EXPORTid_Nullableobjc_storeWeak(id_Nullable* _Nonnull location, id_Nullableobj)
OBJC_AVAILABLE(10.7, 5.0, 9.0, 1.0, 2.0);
Activity
zhuangtao97 commentedon Aug 25, 2018
建议看看weak表的数据结构和实现,key值是对象地址,value 是weak指针地址没错。value值不会无缘无故变为nil的,只有当对象引用计数为0,调用dealloc析构,最后调用objc_clear_deallocating 函数,通过对象地址在weak表中获取value值,也就是所有的weak指针,赋值为 nil。
winterwd commentedon Jun 24, 2020
在多个
__weak的情况下,这个value是不是可以理解为 数组结构呢?q1992077 commentedon Jul 2, 2021
如果一个对象被超过4根弱引用指针指向时,weak表存的是弱指针的哈希表。相当于:
weakTable: {
key(&b) : @{ &a : 1, &a2 : 1, &a3 : 1, &a4 : 1, ...}
...
}
解答一些issue问题 #98 #6 #138
zbbzbl0523 commentedon Mar 6, 2025
哈希表哈希冲突解决办法中的:后面嵌套个数组,红黑树之类的,都是可行的解决办法