什么是IOS保留在后端 [英] What is IOS retain do at backend

查看:210
本文介绍了什么是IOS保留在后端的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

考虑我正在分配一个对象。请参阅下面的图片

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.

推荐答案

实际保留的内容是:


  1. 在objc运行时执行全局锁定

  2. 根据指向要保留的对象的指针查找哈希表条目

  3. 增加该条目中的计数器

  4. 释放锁

  1. Take a global lock in the objc runtime
  2. Look up a hash table entry based on the pointer to the object being retained
  3. Increment a counter in that entry
  4. 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保留在后端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆