 |
 |
dealloc on termination?
|
 |
|
 |
|
Grizzled Veteran
Join Date: Jan 2002
Location: Melbourne, Australia
Status:
Offline
|
|
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
|
|
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
|
|
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
|
|
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.
|
|
|
| |
|
|
|
 |
|
 |
|
Grizzled Veteran
Join Date: Jan 2002
Location: Melbourne, Australia
Status:
Offline
|
|
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.
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |