In my application in tableview cell for row at index method I use the following lines of code
When my application is for analyze I got the following leak
code:
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
//if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
//}
// Configure the cell...
}
I got error like this:
Value stored to cell during its initialization is never read
You initialize the local variable called ‘cell’ in this line:
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];and then you immediately overwrite that value in the next line:
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];The analyzer is calling your attention to this.
In this particular case, this won’t actually result in a leak. But it does mean you are not reusing cells, and so this will affect the performance of your table view.