Iphone SDK array initlised at viewdidload and released at dealloc is causing leak?
- by Skeep
Hi All,
I am new to iphone development and i am getting ready to submit my first app. I have an array initlised at viewdidload and released at dealloc, however it is causing a leak. My question is why would this happen is it because the dealloc has not run?
My Code is as follows the NSMutableArray called listOfItems is referenced in my .h file for the UITableView. The listOfItems array is used to populate the table.
In the viewDidLoad method i have this code
listOfItems = [[NSMutableArray alloc] init];
and in the dealloc i have:
[listOfItems release];
When watching leaks in instruments I get a NSArray leak which when I drill down points to the line:
listOfItems = [[NSMutableArray alloc] init];
Am i putting all this in the right place?
Thanks