• 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: NSDocument reference held by NSSavePanel?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSDocument reference held by NSSavePanel?


  • Subject: Re: NSDocument reference held by NSSavePanel?
  • From: Quincey Morris <email@hidden>
  • Date: Mon, 13 Apr 2009 17:14:22 -0700

On Apr 13, 2009, at 13:56, David Scheidt wrote:

In general, though, it's perfectly reasonable to put off garbage collection for as long as possible. It's fairly expensive, and if there is no pressure on the resource being garbage-collected, it's perfectly reasonable to defer garbage collection until there is pressure. There's a reasonable chance that the application will terminate before then, and then you've save the effort. In other words, it's not the clock that controls whether garbage collection need to run, it's the presence of garbage.

This is a perfectly reasonably argument, and perhaps it's the only argument. But I wasn't suggesting earlier that a garbage collector which doesn't collect as soon as possible (or nearly so) is defective, but that a garbage collector which defers some collections indefinitely implies that the finalize method is useless. (Or, equivalently, that if you want to use finalize, such a garbage collector is defective.)


My reasoning is that finalize is used to manage non-GC resources, not GC memory objects. With an indefinitely deferring collector, where you can't expect finalize to be called "soon", then you've already lost the game in terms of non-GC resource management (because non-GC resources don't exert any pressure on the collector), and you may as well abandon your finalize-based management strategy.

One caveat: if a GC-object manages a *root* reference to another GC- object (for example, object A maintains a reference to object B in a global variable), then finalize would be a suitable place to manage the root reference, even if it is deferred.


_______________________________________________

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: NSDocument reference held by NSSavePanel?
      • From: David Scheidt <email@hidden>
References: 
 >NSDocument reference held by NSSavePanel? (From: Quincey Morris <email@hidden>)
 >Re: NSDocument reference held by NSSavePanel? (From: Michael Ash <email@hidden>)
 >Re: NSDocument reference held by NSSavePanel? (From: Quincey Morris <email@hidden>)
 >Re: NSDocument reference held by NSSavePanel? (From: Michael Ash <email@hidden>)
 >Re: NSDocument reference held by NSSavePanel? (From: Quincey Morris <email@hidden>)
 >Re: NSDocument reference held by NSSavePanel? (From: David Scheidt <email@hidden>)

  • Prev by Date: Re: Exit an Application
  • Next by Date: Re: Best way to get a non-repeating random number?
  • Previous by thread: Re: NSDocument reference held by NSSavePanel?
  • Next by thread: Re: NSDocument reference held by NSSavePanel?
  • Index(es):
    • Date
    • Thread