Re: Why ARC over garbage collection?
Re: Why ARC over garbage collection?
- Subject: Re: Why ARC over garbage collection?
- From: Fritz Anderson <email@hidden>
- Date: Mon, 15 Oct 2012 18:02:19 -0500
On 15 Oct 2012, at 5:38 PM, Rick Mann <email@hidden> wrote:
> So, why is it that Apple considers ARC a better solution that garbage collection? Is it a performance thing?
Garbage collection requires a continuously-running thread. This makes it impossible to throttle power usage and potentially steals cycles from the UI thread. The generational collector is virtually guaranteed to catch orphaned objects _eventually_, but the orphans can take up an arbitrarily large amount of memory waiting for "eventually" to arrive.
None of this is acceptable on devices that have limited battery life, comparatively little RAM, no paging, and CPUs that are orders of magnitude slower than those in desktop machines. And no developer is cheerful about Yet Another Damn Thread.
With ARC, you still have to understand reference-counted memory management, and you still have to debug corner cases. But the corner cases are no easier under garbage collection. You can still end up exhausting memory with transient objects; unlike with garbage collection, there is a reliable way to reproduce and debug such problems.
GC is intolerable on iOS. Whether it's tolerable on the Mac is a matter of opinion, but it's not obvious that GC wins. Apple can't afford to have two automatic memory-management schemes, so GC loses.
— F
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden