Re: Determining unreleased objects after Quit
Re: Determining unreleased objects after Quit
- Subject: Re: Determining unreleased objects after Quit
- From: Joseph Kelly <email@hidden>
- Date: Wed, 03 Dec 2008 13:26:52 -0800
On Dec 3, 2008, at 9:06 AM, Randall Meadows wrote:
On Dec 3, 2008, at 9:38 AM, Jon C. Munson II wrote:
Namaste!
In my application, when I choose File->Quit, the application
appears to
terminate. HOWEVER, it doesn't. SOMETHING(s) is(are) left
unreleased.
Is there a handy way to determine what the object(s) is(are)?
When your app quits, all of its memory used it released back to the
system. However, your deallocs and such will NOT be called, since
that would be a waste of time since everything's going to be
released back to the system anyway. It's a shortcut, and usually is
in your best interest.
It can, however, bite you in certain situations, specifically non-
memory resources that you need to do something with at termination.
In my case, I needed to release access to a camera, so I had to do
some of my cleanup work in -applicationWillTerminate:.
This is correct. I'm not sure exactly the mechanism -- and I suspect
it has something to do with Mach ports owned by the process which are
not shut down correctly -- but I've encountered a case where my app
appears "open" in the Dock, but does not appear in the bsd, Process
Manager, or Mach process lists. This only happens when the app
terminates abnormally, and our shutdown sequence does not execute.
I've also noticed that aborting a Debug session in Xcode 3.1.1 will
sometimes result in the app not quite going away, I presume also as a
result of having mach ports in a weird state.
Joe K.
_______________________________________________
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