• 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: GC pros and cons
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GC pros and cons


  • Subject: Re: GC pros and cons
  • From: Michael Ash <email@hidden>
  • Date: Fri, 26 Jun 2009 22:02:14 -0400

On Fri, Jun 26, 2009 at 8:54 PM, Kyle Sluder<email@hidden> wrote:
> Closures are notoriously hard to implement without some form of
> automatic memory management.  Forgetting everything announced and
> unannounced about upcoming features of ObjC, we have a small version
> of this issue right now, when dealing with NSBeginAlertSheet context
> pointers.

Well, I think that ignoring Apple's upcoming blocks is a mistake here,
because all the relevant details are now public, their implementation
does not require garbage collection, and it's interesting to see how
they've done it.

Details on how it all works are here:

http://clang.llvm.org/docs/LanguageExtensions.html#blocks

The short version is this: blocks are objects which, in a non-GC app,
just get retained and released as usual. When a block is copied, all
of the object-pointer variables that it references get retained to
keep them alive (and subsequently released when the block is
destroyed).

There are some obvious problems with retain cycles due to this design
which will probably somewhat limit where blocks can be used, but
overall it seems pretty straightforward and effective.

Mike
_______________________________________________

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: 
 >Re: GC pros and cons (From: James Gregurich <email@hidden>)
 >Re: GC pros and cons (From: Kyle Sluder <email@hidden>)

  • Prev by Date: Re: GC pros and cons
  • Next by Date: Re: GC pros and cons
  • Previous by thread: Re: GC pros and cons
  • Next by thread: Re: GC pros and cons
  • Index(es):
    • Date
    • Thread