Iphone SDK array initlised at viewdidload and released at dealloc is causing leak?
Posted
by Skeep
on Stack Overflow
See other posts from Stack Overflow
or by Skeep
Published on 2010-04-14T14:24:21Z
Indexed on
2010/04/14
19:23 UTC
Read the original article
Hit count: 404
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
© Stack Overflow or respective owner