Here is my code:
- (void)viewDidLoad{
[super viewDidLoad];
self.authorList = [[NSArray alloc]
initWithObjects:@"Christie, Agatha",
@"Archer, Jeffrey", nil];
self.title = @"Authors";
}
I am getting memory leak at line where i am allocating and init the array authorlist. I tried to put autorelease on authorlist but it says that “Object sent- autorelease sent too many times”. I am still learning memory management.
Gracias.
The setter method for
authorListwill retain the array so you need to release it immediately after calling it:Or you can autorelease it: