xcode 4.2 内存分配/释放

发布于 2024-12-23 20:28:36 字数 274 浏览 4 评论 0原文

你好,我对 xcode 4.2 内存管理系统有疑问。我已阅读此处,在 xcode 4 中您无需担心关于内存分配,我也在做一个教程,但每次我引用释放或自动释放的分配时都会出错,比如 ARC 禁止显式释放消息或类似的事情。我是否应该从现在开始忽略所有对 alloc dealloc 和release 的引用?或者最好关闭 ARC 功能?提前感谢您的建议,因为我对此很陌生

hi I have doubts about the xcode 4.2 memory management system. I have read here that in xcode 4 you don't need to worry about memory allocation and also I am doing a tutorial but I get errors each time I refer to alloc of realease or autorelease, like ARC forbids explicit messages of dealloc or things like that. Shall I from now on ignore all reference to alloc dealloc and release? Or is it better to turn off that ARC thing off?? thks in advance for your advice as i am new to this

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

Spring初心 2024-12-30 20:28:36

保留“ARC 东西”是你能做的最好的事情,可以帮助你自己避免无数时间调试这些讨厌的内存泄漏和悬空指针引用。不要将其关闭,而是阅读更多相关信息以深入了解该功能。 CLang 人员在他们的文档中对此进行了解释,但也有其他 地方解释了这个伟大的新功能非常详细。

Leaving "that ARC thing" on is the best thing you can do to help yourself avoid countless hours debugging these pesky memory leaks and dangling pointer references. Instead of turning it off, read more about it to get a solid understanding of the feature. CLang people did an OK job explaining it in their documentation, but also there are other places where this great new feature is explained in much detail.

○闲身 2024-12-30 20:28:36

删除所有释放和自动释放函数调用。当选择ARC时,不需要调用autorelease或release。 iOS 会为你处理

remove all release and autorelease function calls. you do not need to call autorelease or release when you select ARC. the iOS will handle it for you

久隐师 2024-12-30 20:28:36

保持 ARC 开启。然后去了解 ARC 是什么(这可能对您有帮助 - http://developer.apple.com/library/mac/#releasenotes/ObjectiveC/RN-TransitioningToARC/_index.html)。然后您将了解如何对代码进行 ARC 化,并且可以在转换代码的同时按照教程进行操作。简而言之,使用 ARC 时,您无需显式调用 retainreleaseautorelease

Leave ARC on. Then go and read about what ARC is (this might help you - http://developer.apple.com/library/mac/#releasenotes/ObjectiveC/RN-TransitioningToARC/_index.html). Then you'll understand how to ARC-ify code and you can follow the tutorial at the same time as converting it. In a nutshell, you don't explicitly call retain, release or autorelease when using ARC.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文