Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Is dealloc called for an object instantiated with IB?



On Sep 29, 2007, at 7:56 AM, John Stiles wrote:
On Sep 29, 2007, at 5:46 AM, Finlay Dobbie wrote:
On 29/09/2007, Bob Ueland <email@hidden> wrote:
In Hillegass book chapter 4, there is a class called AppController instantiated with IB. In the file AppController.m there is the following method:

- (void)dealloc
{
    NSLog(@"dealloc");
    [speechSynth release];
    [super dealloc];
}
@end


However when I run the application and quit it, I never see the text "dealloc" appear in the log window. Does this mean that this method is never called?

Correct. There is no point individually freeing the memory for every object at application quit time, because the OS will automatically reclaim all the memory in one big chunk.
That's true, of course, but the counterpoint is that dealloc can be used for more than just strictly freeing memory, and these behaviors will be lost at shutdown time.

Yes -- it can be used for more than just freeing memory.

Don't do that.

Overloading the Cocoa reference counting mechanism to manage more than memory leads to all kinds of hard to debug problems and instabilities. And it simply doesn't work under a garbage collected Objective-C, coming in Leopard.

From the archives:

http://lists.apple.com/archives/cocoa-dev/2007/Jul/msg01220.html

b.bum




_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >Is dealloc called for an object instantiated with IB? (From: Bob Ueland <email@hidden>)
 >Re: Is dealloc called for an object instantiated with IB? (From: "Finlay Dobbie" <email@hidden>)
 >Re: Is dealloc called for an object instantiated with IB? (From: John Stiles <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.