Re: GC pros and cons
Re: GC pros and cons
- Subject: Re: GC pros and cons
- From: Bill Bumgarner <email@hidden>
- Date: Sat, 27 Jun 2009 09:28:33 -0500
There has been enough signal in this thread that I haven't asked for
it to be ended, but it is rapidly spiraling the bowl. Specifically,
the last dozen or so messages -- mine included -- have been a rehash
of the same points. "I like GC" / "I don't like GC" / "GC is non-
deterministic" / "Non-GC is non-deterministic, too" / etc.
There are a number of advantages to using GC vs. non GC that haven't
really been mentioned.
- It is the recommended way. All new Cocoa applications should be
developed using GC. The primary reasoning is two fold and delineated
in the next two points.
- GC applications are less crash prone than non-GC applications (yes,
really -- Xcode's crash frequency has dropped significantly in the
move from non-GC to GC, for example). One of the most common crashes
in Cocoa applications is related to over-releasing of objects or using
dangling references. GC doesn't eliminate crashes, but it certainly
mitigates this particularly common ones.
- GC applications scale better across multi-core for multiple
reasons. Some are obvious; assignment takes ownership of an object
atomically in GC while under non-GC, ownership can only happen through
a non-atomic call to -retain which has to be made atomic through the
use of locks and, often, exception handlers. Not so obvious, though,
is that the collector has a great deal of knowledge about the
connectivity of your app's object graph and this knowledge can be
used-- and is being used somewhat in Leopard and much more so in Snow
Leopard -- to further optimize allocation and reclamation.
The bottom line is that GC offers Apple the opportunity for
significantly greater whole system optimization opportunities than non-
GC. Over time, GC'd applications will get faster -- already have --
for free. This is just like CoreData. Clients of CoreData got a
major performance bump by simply running their app on Leopard.
GC also offers significantly better hooks for analyzing memory usage
and debugging leaks (yes, leaks in GC do occur) and you can expect
this to be reflected in the power / feature set of the higher level
analysis tools such as Instruments.
Finally, GC often improves developer productivity. Fewer lines of
code, simpler patterns, etc....
Bottom line, though, is what best serves the needs of your customers.
If you feel strongly that you can get your product to market faster,
penetrate more markets, with better quality, and more refined features
by using non-GC, then go for it. Obviously, if you are targeting the
iPhone, you have to use non-GC.
b.bum
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden