Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Garbage collector vs variable lifetime




On Jun 7, 2008, at 00:07, Antonio Nunes wrote:

Although I maybe did not make it that clear, I actually meant my suggestion also as a question. I'm surprised no-one else suggested to temporarily turn of garbage collection for this pointer. I'm curious as to why Bill suggested his solution rather than directly instructing the garbage collector, since that would seem to me the more obvious solution. Is Bill's solution preferable in any way? (After all, I'd like to improve to the level where I know what I'm doing ;-)

I can think of one significant difference. Using CFRetain/CFRelease (or your slightly more general equivalent) is a procedural solution -- you would need to make sure there was a matching release on every execution path out of the relevant code.


Using something like '[data self]' is a syntactic solution. It doesn't matter whether it gets executed or not, but its mere presence far enough down the source code is all that's required.

Depending on the circumstances, one or other approach might be preferred.

_______________________________________________

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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >Garbage collector vs variable lifetime (From: Quincey Morris <email@hidden>)
 >Re: Garbage collector vs variable lifetime (From: Bill Bumgarner <email@hidden>)
 >Re: Garbage collector vs variable lifetime (From: Ricky Sharp <email@hidden>)
 >Re: Garbage collector vs variable lifetime (From: Bill Bumgarner <email@hidden>)
 >Re: Garbage collector vs variable lifetime (From: Antonio Nunes <email@hidden>)
 >Re: Garbage collector vs variable lifetime (From: Ken Thomases <email@hidden>)
 >Re: Garbage collector vs variable lifetime (From: Antonio Nunes <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.