• 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
Re: How to allocate and delegate; or how to keep GC and the static analyzer happy
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: How to allocate and delegate; or how to keep GC and the static analyzer happy
      • From: Glen Low <email@hidden>
    • Re: How to allocate and delegate; or how to keep GC and the static analyzer happy
      • From: Glen Low <email@hidden>
References: 
 >How to allocate and delegate; or how to keep GC and the static analyzer happy (From: Glen Low <email@hidden>)

  • Prev by Date: Re: Instance variables: access directly vs. getter / setter
  • Next by Date: Re: Binding to currently selected object in a list?
  • Previous by thread: How to allocate and delegate; or how to keep GC and the static analyzer happy
  • Next by thread: Re: How to allocate and delegate; or how to keep GC and the static analyzer happy
  • Index(es):
    • Date
    • Thread