Is an just allocated object allways set to autorelease? What about my subclasses?
Is an just allocated object allways set to autorelease? What about my subclasses?
- Subject: Is an just allocated object allways set to autorelease? What about my subclasses?
- From: Alexandre Aybes <email@hidden>
- Date: Fri, 21 Dec 2001 12:31:00 +0100
Hi there,
I am tracking down the (gigantic) memory leaks in my application
(I've been doing too much java for too long ;)) And since I am
fairly new to Cocoa/ObjC and I would like to know if all the
basic Cocoa objects (the ones from the AppKit) are set to
autorelease when I call "[[XXX alloc] init]". And another
question when I create my own class, should I do:
- (id)init
{
if (self = [super init])
{
// do my initialization
}
return self;
}
or should I do:
- (id)init
{
if (self = [super init])
{
// do my initialization
}
return [self autorelease];
}
I am confused because all my objects seem to have a too high
retain count... :<
Also if the fact that they are autoreleased depends on the
object, where can I find the docs for that?
Thanks,
Alex.