• 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: Opinion on managed memory and garbage collection
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Opinion on managed memory and garbage collection


  • Subject: Re: Opinion on managed memory and garbage collection
  • From: Rob Keniger <email@hidden>
  • Date: Wed, 24 Jun 2009 13:14:45 +1000


On 24/06/2009, at 7:39 AM, Sean McBride wrote:

If you were writing a new Cocoa application from scratch, would
garbage collection be the preferred method over the reference counting
(retain/release) method.

I switched to GC-only during the 10.5 betas, and my answer is: Yes.


Same here, and in general the experience has been positive. No longer having to worry about retain cycles is bliss.

The biggest issues I've had to deal with are:

- many third-party frameworks and pieces of sample code do not have GC support yet and so you have to check their code quite carefully before trusting it, especially the -dealloc method

- Interface Builder does not use GC (at least in 10.5, don't know about 10.6), so you cannot create an Interface Builder plug-in for a class that requires GC. This is a big problem if you have not written all your code as dual-mode.

- you have to be very careful to make sure all the objects you want to keep around are rooted somewhere, otherwise they will "go away" at unpredictable times.

As others have said, the tools are not quite up to scratch for dealing with GC but there are some nice gdb features like "info gc-roots 0xpointer" and ""info gc-references 0xpointer" which are very helpful.

--
Rob Keniger



_______________________________________________

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: 
 >Opinion on managed memory and garbage collection (From: Phil Hystad <email@hidden>)
 >Re: Opinion on managed memory and garbage collection (From: "Sean McBride" <email@hidden>)

  • Prev by Date: NSScrollView: special handling of subview's headerView?
  • Next by Date: Re: Cocoa and email (SMTP/POP3)
  • Previous by thread: Re: Opinion on managed memory and garbage collection
  • Next by thread: number box class from NSTextField
  • Index(es):
    • Date
    • Thread