当前位置:网站首页>__ Weak and__ The difference between blocks
__ Weak and__ The difference between blocks
2022-07-03 18:47:00 【Kevin writes code】
One 、 __weak Is a weak reference , Use weak The modifier reference count will not increase . The referenced object will be added to a weak_table in , The address of the object will be treated as key,weak The address of the pointer ( The value of the address is the address of the object pointer ) Array as value.
1. Initialize a weak Object or adding a weak reference to an object initializes a weak The pointer points to the address of the object and creates the corresponding weak reference table .
2. When the object is released, it will be transferred from weak_table Get all weak Pointer to an array of addresses , Then traverse the array and empty the array . Then completely empty this element from the table and clean up the records of the object .
Two 、 Use __block The decoration object is block Will not be strongly quoted , And the object is in block Can be changed and reassigned .
__block You can modify objects and basic data types , stay MRC and ARC You can use .__weak Only in ARC And can only decorate objects , stay block Cannot be reassigned .
边栏推荐
- Real time split network (continuous update)
- Why can deeplab v3+ be a God? (the explanation of the paper includes super detailed notes + Chinese English comparison + pictures)
- shell 脚本中关于用户输入参数的处理
- 知其然,而知其所以然,JS 对象创建与继承【汇总梳理】
- 235. 二叉搜索樹的最近公共祖先【lca模板 + 找路徑相同】
- [leetcode weekly race] game 300 - 6110 Number of incremental paths in the grid graph - difficult
- 组策略中开机脚本与登录脚本所使用的用户身份
- 041. (2.10) talk about manpower outsourcing
- 2022-2028 global sepsis treatment drug industry research and trend analysis report
- English語法_名詞 - 分類
猜你喜欢

application

2022-2028 global petroleum pipe joint industry research and trend analysis report

leetcode:11. 盛最多水的容器【双指针 + 贪心 + 去除最短板】
![[Yu Yue education] theoretical mechanics reference materials of Shanghai Jiaotong University](/img/52/b97c618a8f2eb29ad0ccca221bb5c1.jpg)
[Yu Yue education] theoretical mechanics reference materials of Shanghai Jiaotong University

Redis cache avalanche, penetration, breakdown

Getting started with JDBC

平淡的生活里除了有扎破皮肤的刺,还有那些原本让你魂牵梦绕的诗与远方

Opencv learning notes (continuously updated)

2022-2028 global aircraft head up display (HUD) industry research and trend analysis report

Integrated easy to pay secondary domain name distribution system
随机推荐
041. (2.10) talk about manpower outsourcing
Sqlalchemy - subquery in a where clause - Sqlalchemy - subquery in a where clause
Boost. Asio Library
Summary and Reflection on the third week of winter vacation
Hard disk monitoring and analysis tool: smartctl
235. The nearest common ancestor of the binary search tree [LCA template + same search path]
2022-2028 global petroleum pipe joint industry research and trend analysis report
Software development freelancer's Road
Sepconv (separable revolution) code recurrence
Have you learned the correct expression posture of programmers on Valentine's day?
Suffix derivation based on query object fields
CTO and programmer were both sentenced for losing control of the crawler
Pytorch introduction to deep learning practice notes 13- advanced chapter of cyclic neural network - Classification
Shell script return value with which output
Typescript official website tutorial
[combinatorics] generating function (positive integer splitting | unordered non repeated splitting example)
Xception for deeplab v3+ (including super detailed code comments and original drawing of the paper)
Win 11 major updates, new features love love.
Multifunctional web file manager filestash
Torch learning notes (4) -- torch's dynamic calculation diagram