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 12:13:47 +0100
On 18 mar 2006, at 12.04, Karim Morsy wrote:
Cocoa will skip over sending deallocation messages to objects when
your app is about to quit.
so it doesn't really make any sense to override dealloc in an app
controller and release any of the allocated memory, such as for
NSString, nsarray or custom obejcts etc.., right ?
For objects that you intend to keep around for the duration of the
application lifetime (typically using the "singleton" design pattern)
there is little reason to implement dealloc. That said, I would still
strongly suggest that you do, because it's a good habit to get into!
I always dutifully implement correct dealloc methods in all classes.
This is an optimization, as all memory will be reclaimed by the OS
after the app has terminated in any case.
i see, so memory leaks can only occur during runtime and never
after an app has terminated, be it normally or due to a chrash ?
Exactly. Memory wise, your application is living in a "box" that the
OS provides for it. When the app quits, the OS reclaims the entire
box of memory. Your app is not allowed to allocate memory outside of
this box, and so can't generate memory leaks after it's terminated -
regardless of it's a controlled termination or a crash.
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