• 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: Bill Bumgarner <email@hidden>
  • Date: Thu, 25 Jun 2009 15:42:04 -0500

On Jun 25, 2009, at 3:14 PM, Peter Ammon wrote:
In any case, it's been my experience that GC makes memory management much easier, but precious resource management somewhat harder. It's harder because GC forces more of a divorce between the management of memory and precious resources, and the precious resource management techniques are about on the level with C circa 1989.

Really, retain/release requires such a separation, too. At least, it does for relatively complex, often concurrent, piles of code.


I'll speak anecdotally instead of making broad claims. I have had to track down and fix more than a dozen bugs over the years that have all boiled down to exhaustion of some scarce resource such as a file descriptor, server connection or the like.

While the cause was sometimes simply a leak, it has often been caused by unexpectedly long delays until the autorelease pool was drained.

Even with leaks, a small leak is something that should be fixed, but is also something that you can live with for a while -- leaking 300 allocation nodes of 48 bytes each, say, every time a document is closed is only 14k per document and, thus, the user is gonna have to open/close an awful lot of documents to cause a problem.

However, if even a subset of those 300 nodes also contains some scarce resource, what is a minor problem will then be a major, possibly catastrophic, problem.

As well, if there are any kind of ordering dependencies when tearing down stuff, your code's fragility will be greatly reduced by moving the dependencies outside of memory reclamation. Otherwise, one stray - autorelease will cause the house of cards to crumble.

b.bum
_______________________________________________

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: GC pros and cons
      • From: Peter Ammon <email@hidden>
References: 
 >Re: GC pros and cons (From: Quincey Morris <email@hidden>)
 >Re: GC pros and cons (From: Chris Idou <email@hidden>)
 >RE: GC pros and cons (From: Jeff Laing <email@hidden>)
 >Re: GC pros and cons (From: "Stephen J. Butler" <email@hidden>)
 >Re: GC pros and cons (From: Peter Ammon <email@hidden>)
 >Re: GC pros and cons (From: Kyle Sluder <email@hidden>)
 >Re: GC pros and cons (From: Peter Ammon <email@hidden>)
 >Re: GC pros and cons (From: Kyle Sluder <email@hidden>)
 >Re: GC pros and cons (From: Peter Ammon <email@hidden>)

  • Prev by Date: Re: Programmatically Picking Elements
  • 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