Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > dealloc on termination?

dealloc on termination?
Thread Tools
Grizzled Veteran
Join Date: Jan 2002
Location: Melbourne, Australia
Status: Offline
Reply With Quote
Nov 5, 2005, 06:51 AM
 
I'm working on a little Cocoa app and have a problem regarding deallocation of objects instantiated in the NIB file. I have a Controller object in the MainMenu NIB file of my project. This object's dealloc method never gets called when the app exits and I was wondering how this is generally handled. Do I call release in applicationWillTerminate or something like that or am I just missing something?
     
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status: Offline
Reply With Quote
Nov 5, 2005, 10:16 AM
 
Your application's memory is freed by the kernel when you exit. You shouldn't need to release it yourself.
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
     
Mac Elite
Join Date: Jul 2002
Status: Offline
Reply With Quote
Nov 5, 2005, 02:36 PM
 
Of course, some parts of the app will remain in memory until the kernel decides new memory requests should take it. That way subsequent launches of the app are faster.
     
Mac Elite
Join Date: Aug 2001
Status: Offline
Reply With Quote
Nov 5, 2005, 05:47 PM
 
Originally Posted by Chuckit
Your application's memory is freed by the kernel when you exit. You shouldn't need to release it yourself.
He might have other resource cleanup he needs to do in dealloc, though. I'd say -applicationWillTerminate is a good way of handling that.
     
WJMoore  (op)
Grizzled Veteran
Join Date: Jan 2002
Location: Melbourne, Australia
Status: Offline
Reply With Quote
Nov 5, 2005, 07:07 PM
 
Originally Posted by Catfish_Man
He might have other resource cleanup he needs to do in dealloc, though. I'd say -applicationWillTerminate is a good way of handling that.
I'm aware that it will be cleaned up but it's not an elegant way to handle it in my view. As Catfish_Man mentioned there are other things that may be handled in the process like closing open files. I'll give applicationWillTerminate a go. Might also find some open source Cocoa apps and see how/if it's done in them.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 07:41 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2