• 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: Sat, 10 Oct 2009 12:38:07 -0700


On Oct 10, 2009, at 2:25 AM, Glen Low wrote:

Not necessarily. In a pathological but presumably legit case, whatever happens in initDelegate: might only form a weak reference to the Something object, thus the Something object would be subject to GC.

That's true, although unlikely. In that case you could create an instance variable of the owning object, to point to the Something object.


Or the thread etc. could somehow fail and never call finishWithSomething: (thus leaking the Something object).

I don't think you mean "leak" there; if the thread exits, the Something object would just be collected.
The Something method that runs on the thread should have an @try block around it, so that if anything goes wrong it can clean up (including calling back into your main object) before it finishes.


—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


References: 
 >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: Jens Alfke <email@hidden>)
 >Re: How to allocate and delegate; or how to keep GC and the static analyzer happy (From: Glen Low <email@hidden>)

  • Prev by Date: Re: real verses Virtual memory
  • Next by Date: Re: real verses Virtual memory
  • Previous by thread: Re: 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