Re: How to allocate and delegate; or how to keep GC and the static analyzer happy
Re: How to allocate and delegate; or how to keep GC and the static analyzer happy
- Subject: Re: How to allocate and delegate; or how to keep GC and the static analyzer happy
- From: Jens Alfke <email@hidden>
- Date: Fri, 9 Oct 2009 21:29:18 -0700
On Oct 8, 2009, at 7:33 PM, Glen Low wrote:
1. The code is not GC friendly as between the end of start and the
beginning of finishWithSomething, there are no references to the
object, so it may be collected.
There must be references to it; otherwise how would that object's
methods get called later on? Either it's a delegate of another object
(an NSURLConnection or NSTimer or whatever) or it starts a new thread
to run one of its methods. Either way, there are references to the
object that keep it alive.
2. The static analyzer in Xcode 3.2 doesn't like the construction,
thinking that the object is leaking from the start method.
I'm not sure what to do about that. Casting the result to (void) might
help, to explicitly state that you don't want to use the result. (Does
the static analyzer even work with GC? Stating that the object is
"leaking" only makes sense in a ref-counted environment.)
—Jens_______________________________________________
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