Re: Memory Allocation
Re: Memory Allocation
- Subject: Re: Memory Allocation
- From: "Kyle Sluder" <email@hidden>
- Date: Wed, 16 Jul 2008 14:38:10 -0400
On Wed, Jul 16, 2008 at 2:02 PM, Alexandre Badez
<email@hidden> wrote:
> -(id)init
> {
> if (![super init])
> return nil;
You must always assign self to the result of [super init]. If anyone
(*cough* Wil Shipley *cough*) tells you otherwise, they may
inadvertently set you up for some seriously subtle errors.
So the code would be:
- (id)init
{
if(self = [super init]) // single = is intentional
NSLog(@"-[%@ init]", [self className]);
return self;
}
Anyway, your problem is here:
> NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
Why are you doing this? AppKit creates an autorelease pool for you.
--Kyle Sluder
_______________________________________________
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:
This email sent to email@hidden