Re: Opinion on managed memory and garbage collection
Re: Opinion on managed memory and garbage collection
- Subject: Re: Opinion on managed memory and garbage collection
- From: Quincey Morris <email@hidden>
- Date: Mon, 22 Jun 2009 23:09:28 -0700
On Jun 22, 2009, at 21:21, Michael Ash wrote:
IMO there are three major reasons to avoid GC at this point:
Your reasons are clearly stated, rational, compelling ... and almost
*entirely* anecdotal. That means what you say is a personal
perspective -- and I'm pretty sure that you know that. But there are 2
things that concern me:
1) You're very convincing, maybe more even than you intended, so I'm
afraid others might take this perspective as the *only* perspective
(aka "fact").
2) Your description of life in a GC world is unrecognizable to me, and
I stopped writing non-GC code at the beginning of 2008.
Yes, there are bugs in the GC versions of frameworks not in the non-GC
versions, and that's annoying. But there are "plenty" of bugs in the
frameworks that aren't dependent on GC. This only reflects badly on GC
if we have numerical information about the number of GC-related bugs
likely to affect a developer now, versus the number of non-GC-related
bugs.
Yes, there are frameworks (or pieces of frameworks) that don't have a
GC-compatible implementation. That frustrates writing some kinds of
applications, sure.
There are a *very* small number of very surprising pitfalls using GC,
but I don't think it's established that they're a debugging nightmare.
When I've run into them, they've exploded pretty unsubtly. The
solution usually isn't difficult, just unpalatable because it brings
back housekeeping source code in places where you'd expect things to
happen automatically/codelessly with GC.
Further, I'd suggest it's more about familiarity with coding patterns
than inherent difficulty or danger. You can crash a retain/release app
very easily by breaking a simple rule or two. But we don't have
developers throwing themselves off cliffs in despair as a result,
because everyone learns what simple rules not to break. It's currently
much easier to be unaware of the simple rules in the GC world, because
familiarity with safe GC coding patterns just isn't as widespread yet.
(But balanced against that, there's much less of that crap to learn on
the GC side.)
Bugs and unimplemented APIs aside, consider how many questions have
been posted on this list in the last *year* asking about how to code
something in a GC app so as to avoid a perplexing crash. I think it's
been something like 3.
By contrast, how many such questions concerning a non-GC app are
posted in an average *week*. I think it's often more than 3. Sometimes
it's 3 a day. We just don't think about it much because answering has
becoming pretty formulaic.
So while I'm perfectly happy for people to read your account of the
unpleasant parts of the GC experience, I'd contend that the real
answer is for *more* people to write GC apps, not less. The more
people there are, the more voices there are yelling at Apple to fix
the bugs and fill in the gaps. And, as you point out, the next
iteration of GC may be a giant step towards non-controversiality, but
we'll have to wait till September to find out.
_______________________________________________
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