Re: Garbage collector vs variable lifetime
Re: Garbage collector vs variable lifetime
- Subject: Re: Garbage collector vs variable lifetime
- From: Quincey Morris <email@hidden>
- Date: Sat, 7 Jun 2008 01:41:03 -0700
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:
This email sent to email@hidden