Re: Why does this keep sending EXC_BAD_ACCESS
Re: Why does this keep sending EXC_BAD_ACCESS
- Subject: Re: Why does this keep sending EXC_BAD_ACCESS
- From: j o a r <email@hidden>
- Date: Tue, 30 Mar 2004 20:07:28 +0200
Almost, but your example is actually even worse - double autoreleases
== immediate crash.
Remember that the class-convenience-factory methods (for example
"arrayWithCapacity: ") always returns autoreleased objects.
You should use the alloc-init pattern when assigning your instance
variables.
Read up on the documentation on ObjC/Cocoa memory management! There's a
lot of info to be found in the docs from Apple, various third parties,
and in the list archives.
j o a r
On 2004-03-30, at 19.36, Angel Caban wrote:
>
By assigning an autoreleased object do you mean something like this:
>
- (id)init
>
{
>
self = [super init];
>
>
if(self) {
>
serverWindows = [[NSMutableArray arrayWithCapacity:5] autorelease];
>
channelWindows = [[NSMutableArray arrayWithCapacity:15] autorelease];
>
>
[serverWindows retain];
>
[channelWindows retain];
>
}
>
>
return self;
>
}
[demime 0.98b removed an attachment of type application/pkcs7-signature which had a name of smime.p7s]
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.