TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Mac Apps That Use Garbage Collection Must Move to ARC

104 pointsby tachionover 10 years ago

11 comments

zbowlingover 10 years ago
To head off some of the misconceptions here, this is not about garbage collection in general but Objective-C built-in garbage collection.<p>Apple NEEDs to do this for their own sanity. I&#x27;m surprised they waited this long actually.<p>It&#x27;s a serious PITA to support GC and non GC at the same time in a framework. Having to add finalizer methods instead of relaying on dealloc methods and dealing with non-deterministic object lifetime as well as deterministic was a huge problem.<p>ARC doesn&#x27;t have these problems because it wraps traditional manual reference counting (to pick nits, it actually bypasses it when it can safely but this is an optimization detail that you shouldn&#x27;t need to worry about).<p>To Apple and 3rd party framework developers, it&#x27;s painful to support GC and non-GC paths in your code at the sametime. It&#x27;s not really possible to use a non-GC compatible framework in a GC app.<p>It&#x27;s also impossible to use ARC and still support the GC as well in the same framework. Apple has been completely <i>prevented</i> from using ARC in it&#x27;s own frameworks because of keeping GC compatible apps working, and making this change will allow them to start ARC-ifying their own code.<p>It also means that a significant chunk of the ObjC runtime can be simplified.<p>There are also some great advancements in the ObjC runtime that Apple is doing (like tagged pointers and shadow objects) that the reference boehm garbage collector can&#x27;t really deal with and was all completely disabled in the ObjC runtime when you had a GC app.<p>This is a good thing. Not many app actually shipped with the ObjC garbage collector and ran well.<p>Now you are free to use your GC for your own needs in your app. That has nothing to do with ObjC. Feel free to add Java or Ruby or whatever language you like to your own app and submit that to the Mac App Store.
评论 #9085842 未加载
评论 #9089184 未加载
评论 #9085792 未加载
jeffscoover 10 years ago
What Apple calls &quot;automatic reference counting&quot; is what is usually known as just &quot;reference counting.&quot; They call it &quot;automatic&quot; to distinguish it from the previous, even cruder, system where counts were manipulated directly by the programmer. Obviously this is an improvement, but personally I am a supporter of GC. It is a myth that reference counting is not subject to arbitrary pauses: <a href="http://www.hboehm.info/gc/myths.ps" rel="nofollow">http:&#x2F;&#x2F;www.hboehm.info&#x2F;gc&#x2F;myths.ps</a>
评论 #9088200 未加载
philippnagelover 10 years ago
Any other languages that use Automatic Reference Counting? Is ARC strictly better than GC?<p>(Sorry for the question, I am not an iOS, Mac dev.)
评论 #9087019 未加载
评论 #9088614 未加载
评论 #9085974 未加载
评论 #9085953 未加载
评论 #9085935 未加载
danbrucover 10 years ago
What is the reasoning behind that? Given the advances over the last decade or two automatic garbage collection is good enough for a lot of scenarios and this looks like a step back. Why not use automatic garbage collection as the default but offer additional means for manual resource management in case it is really needed?
评论 #9085821 未加载
评论 #9085758 未加载
评论 #9085736 未加载
评论 #9085755 未加载
评论 #9085749 未加载
评论 #9085827 未加载
amit_mover 10 years ago
Does ARC work like reference counting in python? (i.e. a reference count is stored for every object)
评论 #9088758 未加载
评论 #9085793 未加载
falcolasover 10 years ago
I wonder how many applications will start leaking memory as a result of this? Cyclic references are not that uncommon in many algorithms, and identifying the need to remove these will be challenging for applications which relied on automatic identification will take time.
评论 #9086915 未加载
评论 #9086108 未加载
jakobeggerover 10 years ago
This is a pity. I have an app that uses ARC on 64bit, and GC on 32bit. Allowed me to ditch manual memory management without dropping support for 32bit machines.
评论 #9086011 未加载
评论 #9086980 未加载
userbinatorover 10 years ago
I&#x27;m not so familiar with the Mac ecosystem, but is it really true that Apple decides what languages you can use to write your apps in?
评论 #9085891 未加载
zomgbbqover 10 years ago
<a href="https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/AutomaticReferenceCounting.html" rel="nofollow">https:&#x2F;&#x2F;developer.apple.com&#x2F;library&#x2F;ios&#x2F;documentation&#x2F;Swift&#x2F;...</a>
tacosover 10 years ago
Awesome. Now all they gotta do is stop treating strings like we&#x27;re in a Pascal Intro to Computer Science class circa 1987 and we gots ourselves a kick ass development environment here. :)
jimrandomhover 10 years ago
What the fuck? This is a <i>really</i> bad technical decision. As written, it sounds like they&#x27;re planning to reject garbage collection in-general, which would be a ban on most major programming languages. If you assume they only mean garbage collection in Objective C, it&#x27;s still a head-scratchingly stupid decision. Modifying an app to not use garbage collection is, in many cases, a major project that will introduce a lot of bugs. And the benefit is... very dubious at best.
评论 #9085744 未加载
评论 #9085807 未加载
评论 #9085757 未加载
评论 #9085851 未加载