Re: which cocoa objects to dealloc ?
Re: which cocoa objects to dealloc ?
- Subject: Re: which cocoa objects to dealloc ?
- From: j o a r <email@hidden>
- Date: Sat, 18 Mar 2006 11:40:57 +0100
On 18 mar 2006, at 11.25, Karim Morsy wrote:
put logs in all of my custom object''s dealloc methods and
obviously none of them seems to get called when the app terminates.
This is a really frequently asked question, so it's probably not
documented well enough...
Cocoa will skip over sending deallocation messages to objects when
your app is about to quit. This is an optimization, as all memory
will be reclaimed by the OS after the app has terminated in any case.
Check the NSApplication termination notification if there's some work
that you need to perform at this time. Don't overload your memory
management primitive methods for this purpose.
for example, my custom NSView... when I send release to it before
the app quites nothing happens. if I send release twice the app
crashes. so in short...do I have to explicitly send dealloc to ANY
custom object I create, be it a view, a controller, or something
else ?
Never, ever, send dealloc to anything! Follow the Cocoa memory
management guidelines, and let Cocoa deal with the rest.
j o a r
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden