Re: HELP please. ;-) Exception error...
Re: HELP please. ;-) Exception error...
- Subject: Re: HELP please. ;-) Exception error...
- From: Dan Bernstein <cocoa-dev%email@hidden>
- Date: Sun, 9 Mar 2003 01:09:05 +0200
On Sunday, March 9, 2003, at 12:51 AM, Steven M.Palm wrote:
Then, in the class -init() method, I have:
masterList = [NSMutableArray arrayWithCapacity:50];
You don't retain masterList. arrayWithCapacity, like most other
convenience methods of its kind, returns an autoreleased object, that
is, and object that's going to be released when the method that
obtained it (in your case, -init) returns. If you want to keep
masterList around (and since it's an instance variable, you probably
want to), then you should do something like
masterList = [[NSMutableArray arrayWithCapacity:50] retain];
And, in order not to leak, remember to override -dealloc and in it to do
[masterList release];
and not to forget, at the end, to call
[super dealloc];
HTH,
-- Dan
_______________________________________________
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.