• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
GC pros and cons
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

GC pros and cons


  • Subject: GC pros and cons
  • From: Philip Aker <email@hidden>
  • Date: Wed, 24 Jun 2009 09:14:06 -0700

(was: Re: NSString Retain Count of 2147483647)

On 2009-06-24, at 08:05:49, Clark Cox wrote:

On Wed, Jun 24, 2009 at 7:58 AM, Gwynne Raskind<email@hidden > wrote:

Keep in mind that I'm a very NON-fan of GC, but that's because 1, I
understand retain/release management very well and have been consistently
successful with it, 2, GC has hidden pitfalls (like the internal pointer
problem) that frankly confuse the heck out of me, 3, my style of coding
tends to avoid retain cycles, and 4, I'm from the old school of coding where
you didn't even have reference counting, just NewPtr/Handle and
DisposePtr/Handle :). A lot of arguments have been made in favor of GC and I
suggest considering them carefully. (See the cocoa-dev and objc- language
archives for several recent discussions.)

In my experience, the edge-cases that you encounter when using GC, are
*much* rarer than the problems encountered when using retain/release.
Unless given a good reason not to (i.e. needing to support 10.4 or the
iPhone), I would *always* default to using GC on OS X. (and prior to
actually using it, I was deeply in the anti-GC camp).

I read somewhere that using ref-counted garbage collection isn't the best choice. I understand of course, that there isn't much of a choice of what kind of collector to use for Mac OS X.


Like Gwynne, I'm comfortable with the traditional "reap what you sow" philosophy. This has benefits in that the basic policy spills over into other areas of programming and gradually, one learns as a matter of habit, to account for things all the time. This is good but can be lumped in with many other things learned from the school of hard knocks. With GC, the attitude is like one could fire a shotgun into a crowd and the walk away because the system will take responsibility for the consequences. Maybe you could say that's a moral issue. But it's certainly not something children should be taught in school.

In a nutshell, for folks like me who regularly use CFCreate … CFRelease in loops, what are the benefits of GC?


Philip Aker echo email@hidden@nl | tr a-z@. p-za-o.@

Democracy: Two wolves and a sheep voting on lunch.

_______________________________________________
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


References: 
 >NSString Retain Count of 2147483647 (From: Thomas Wetmore <email@hidden>)
 >Re: NSString Retain Count of 2147483647 (From: Gwynne Raskind <email@hidden>)
 >Re: NSString Retain Count of 2147483647 (From: Clark Cox <email@hidden>)

  • Prev by Date: Re: Code sign issues
  • Next by Date: Re: NSString Retain Count of 2147483647
  • Previous by thread: Re: Using Snow Leopard for development (was: NSString Retain Count of 2147483647)
  • Next by thread: Re: NSString Retain Count of 2147483647
  • Index(es):
    • Date
    • Thread