当前位置:网站首页>__ 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 .
边栏推荐
- G1 garbage collector of garbage collector
- Web3 credential network project galaxy is better than nym?
- English grammar_ Adjective / adverb Level 3 - multiple expression
- SQL: special update operation
- Torch learning notes (5) -- autograd
- English語法_名詞 - 分類
- Torch learning notes (2) -- 11 common operation modes of tensor
- Ping problem between virtual machine and development board
- Read the paper glodyne global topology preserving dynamic network embedding
- SQL custom collation
猜你喜欢
Okaleido, a multimedia NFT aggregation platform, is about to go online, and a new NFT era may come
leetcode:11. 盛最多水的容器【雙指針 + 貪心 + 去除最短板】
FBI warning: some people use AI to disguise themselves as others for remote interview
How to read the source code [debug and observe the source code]
Raft log replication
2022-2028 global plasmid DNA cdmo industry research and trend analysis report
my. INI file not found
2022-2028 global petroleum pipe joint industry research and trend analysis report
虚拟机和开发板互Ping问题
Opencv learning notes (continuously updated)
随机推荐
Typescript configuration
Shell script return value with which output
How to read the source code [debug and observe the source code]
KINGS
What London Silver Trading software supports multiple languages
Integrated easy to pay secondary domain name distribution system
Analysis of the reasons why enterprises build their own software development teams to use software manpower outsourcing services at the same time
变化是永恒的主题
Mysql45 lecture learning notes (II)
Processing of user input parameters in shell script
042. (2.11) do it when it's time to do it
my. INI file not found
Caddy server agent
webcodecs
Day-27 database
189. Rotation array
Raft log replication
[combinatorics] generating function (positive integer splitting | unordered non repeated splitting example)
235. 二叉搜索树的最近公共祖先【lca模板 + 找路径相同】
Ping problem between virtual machine and development board