Skip navigation.
 
mlRe: How to delay application quit?
FROM : j o a r
DATE : Tue Mar 25 17:44:31 2008

On Mar 25, 2008, at 9:26 AM, James Hober wrote:

> Do you write the dealloc anyway?  Just wondering what others do. 
> Personally I still write a dealloc method in a class for an object 
> that I keep around for the life of the app.  Then I preface it with 
> a self-amusing comment:
>
> //actually this dealloc never gets called - the app just 
> relinquishes all memory upon quitting.
> //But just to keep things tidy...
>
> I suppose this is utter superstition on my part.  Yet somehow I feel 
> better that there are matching releases, etc. that never get called.
>
> And of course, if the class were ever used not solely for a single 
> object that lingers for the life of the app but for objects that 
> come and go, then the proper memory management is in place.



I wouldn't recommend doing that. I'd suggest using something like this:

- (void) dealloc
{
   NSAssert(FALSE, @"Singleton objects should never be released");
   [super dealloc];
}

This communicates better what your intention is, and also catches the 
unlikely case of this instance ever being deallocated when it 
shouldn't, or if the class is being repurposed to a multi-instance 
pattern.

j o a r

Related mailsAuthorDate
mlHow to delay application quit? Samvel Mar 24, 02:55
mlRe: How to delay application quit? Sherm Pendley Mar 24, 04:24
mlRe: How to delay application quit? Samvel Mar 24, 04:36
mlRe: How to delay application quit? Sherm Pendley Mar 24, 04:42
mlRe: How to delay application quit? Ken Thomases Mar 24, 21:12
mlRe: How to delay application quit? James Hober Mar 25, 17:26
mlRe: How to delay application quit? Steve Bird Mar 25, 17:34
mlRe: How to delay application quit? j o a r Mar 25, 17:44
mlRe: How to delay application quit? James Hober Mar 25, 23:19
mlRe: How to delay application quit? j o a r Mar 25, 23:26