使用或不使用自动引用计数 [英] To use Automatic Reference Counting or not to use

查看:60
本文介绍了使用或不使用自动引用计数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在学习Objective C,到目前为止,我一直在所有项目中使用自动引用计数.但是,在与一些同事交谈之后,并在网上浏览了一些论坛之后,Ive注意到一种趋势,即关闭了自动引用计数"并手动管理内存.

Im currently learning Objective C, and so far Ive been using Automatic Reference Counting with all my projects. However after speaking to some colleagues, and after looking at some forums online, Ive noticed a trend to turn off Automatic Reference Counting and manage memory manually.

我一直想知道ARC是否做得足够好,还是偶尔丢球.手动分配/取消分配内存是否更有效?是否有人因为这就是他们习惯而关闭了ARC?

Ive been wondering if ARC does a good enough job, or if it occasionally drops the ball. Is manually allocating/deallocating memory more efficient? Do some people turn ARC off because that is what they are used to?

我应该继续使用ARC吗?如果不是这样,有人会在将来知道ARC足以使用吗?

Should I continue to use ARC? And if not, does anybody know of a point in the future where ARC will be good enough to use?

推荐答案

与大多数人相比,ARC在内存处理方面做得更好.只有在某些情况下才最好关闭ARC的使用,但是我怀疑我们中的许多开发人员是否还会需要.

ARC does a far better job in memory handling then most humans will. Only in certain cases the use of ARC is better turned off, but I doubt many of us developers will ever need too.

另请参阅: 向ARC还是不向ARC?优点和缺点是什么?

这篇关于使用或不使用自动引用计数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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