问题描述
考虑我正在分配一个对象。请参阅下面的图片
Consider I am allocating an object. Please see the below image
在上面的图片中* myObject是一个指针。它指的是分配给该对象的空间。当我们保留对象时,我喜欢知道它在后端做什么。
In the above image *myObject is a pointer. It is referring to an space allocated to that object. When we retain the object, I like to know what it does at backend. Also I like to know why we are doing that.
也是当我们发布它在后台如何工作时。
Also when we release it how it works at backend.
我也想知道当我们复制对象时在后端会发生什么。
I also like to know what happens at backend when we copy an object.
我真的很抱歉,如果我的问题是这么基础。
I am really sorry if my question is so basic.
推荐答案
实际保留的内容是:
- 在objc运行时执行全局锁定
- 根据指向要保留的对象的指针查找哈希表条目
- 增加该条目中的计数器
- 释放锁
- Take a global lock in the objc runtime
- Look up a hash table entry based on the pointer to the object being retained
- Increment a counter in that entry
- Release the lock
在实践中有所帮助,但我认为这是你要求的。
I don't expect this to be all that helpful in practice, but I think it's what you were asking for.
这篇关于什么是IOS保留在后端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!