本文介绍了为什么自动释放特别危险/昂贵的iPhone应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一个主要来源(或一个非常好的解释)来支持在编写软件时使用 autorelease 是危险或过于昂贵的说法iPhone。

I'm looking for a primary source (or a really good explanation) to back up the claim that the use of autorelease is dangerous or overly expensive when writing software for the iPhone.

一些开发人员提出这个说法,我甚至听说Apple不推荐它,但我还是没有能够找到任何具体的资源来支持它了。

Several developers make this claim, and I have even heard that Apple does not recommend it, but I have not been able to turn up any concrete sources to back it up.

SO参考:



注意:从概念的角度来看,我可以看到 autorelease 比对发布的简单调用稍贵,但我不认为小额罚款足以让Apple推荐反对它。

Note: I can see, from a conceptual point of view, that autorelease is slightly more expensive than a simple call to release, but I don't think that small penalty is enough to make Apple recommend against it.

真实的故事是什么?

推荐答案

(不能接受你自己的答案?)

(cannot accept your own answer?)

嗯,毕竟,我确实设法找到了来自Apple Developer的参考,在页面底部附近作为附注添加:

Well, after all that, I did manage to find a reference from Apple Developer, added as a side-note near the bottom of the page:

但是,这建议谨慎使用autorelease,而不是完全避免它。

Still, this suggests using autorelease carefully, not avoiding it altogether.

(现在我的评论)

听起来有一定数量的维护池的开销。我阅读了尽量避免自动释放,因为我更喜欢事物保持一致。如果你在自动释放下有一些内存,而其他内存完全是手动管理的,那可能会有点混乱。

It sounds like there is a certain amount of overhead in maintaining the pool. I read this article which would lead me to probably avoid autorelease as much as possible because I prefer things to be consistent. If you have some memory under autorelease and other memory being totally manually managed it can be a bit more confusing.

这篇关于为什么自动释放特别危险/昂贵的iPhone应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-27 13:36