• 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 delay application quit?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to delay application quit?


  • Subject: Re: How to delay application quit?
  • From: James Hober <email@hidden>
  • Date: Tue, 25 Mar 2008 09:26:47 -0700

When an application quits, it does _not_ properly release all of your
objects.  Thus, their dealloc methods are generally not called.  This
is a deliberate optimization since there's no point in manually
cleaning up the process memory.  The kernel will completely eliminate
the process address space (and do other cleanup) when the process
exits.

Do you write the dealloc anyway? Just wondering what others do. Personally I still write a dealloc method in a class for an object that I keep around for the life of the app. Then I preface it with a self-amusing comment:


//actually this dealloc never gets called - the app just relinquishes all memory upon quitting.
//But just to keep things tidy...


I suppose this is utter superstition on my part. Yet somehow I feel better that there are matching releases, etc. that never get called.

And of course, if the class were ever used not solely for a single object that lingers for the life of the app but for objects that come and go, then the proper memory management is in place.

What do you do?

James
_______________________________________________

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: How to delay application quit?
      • From: j o a r <email@hidden>
    • Re: How to delay application quit?
      • From: Steve Bird <email@hidden>
  • Prev by Date: Providing synch/asynch API
  • Next by Date: Re: Alternate row colors and selection
  • Previous by thread: Re: How to delay application quit?
  • Next by thread: Re: How to delay application quit?
  • Index(es):
    • Date
    • Thread