Note that there are some explanatory texts on larger screens.

plurals
  1. POInstruments shows leak when dequeuing Custom table view cells in cellForRowAtIndexPath
    text
    copied!<p>I am getting a memory leak in Instruments related to the table view delegate method cellForRowAtIndexPath when using custom table view cells. I am using XCode 5 but ARC is disabled. I have created my custom table view cell as a separate xib and I load that xib in my viewDidLoad method using nibWithNibName (which, if i remember, checks whether you have a cell or not so you dont have to check if cell != nil in the delegate method). Below are the sections of code that are relevant:</p> <blockquote> <p>static NSString *const TransactionResultCellIdentifier = @"TransactionResultCell";</p> </blockquote> <pre><code>- (void)viewDidLoad { [super viewDidLoad]; UINib *cellNib = [UINib nibWithNibName:TransactionResultCellIdentifier bundle:nil]; [self.transactionsTableView registerNib:cellNib forCellReuseIdentifier:TransactionResultCellIdentifier]; cellNib = [UINib nibWithNibName:LoadingCellIdentifier bundle:nil]; [self.transactionsTableView registerNib:cellNib forCellReuseIdentifier:LoadingCellIdentifier]; } -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ TransactionResultCell *cell = (TransactionResultCell *)[tableView dequeueReusableCellWithIdentifier:TransactionResultCellIdentifier]; if(self.isLoading){ return [tableView dequeueReusableCellWithIdentifier:LoadingCellIdentifier]; } else{ TransactionResult *transactionResult = [self.transactionResults objectAtIndex:indexPath.row]; cell.transactionDescriptionLabel.text = [NSString stringWithFormat:@"%@: %@", transactionResult.transactionID, transactionResult.transactionDescription]; cell.transactionPriceLabel.text = [@"Price: $" stringByAppendingString:transactionResult.transactionPrice]; self.totalPrice += [transactionResult.transactionPrice doubleValue]; } return cell; } </code></pre> <p>Instruments points me to the line up above where i am attempting to dequeue the custom table view cell along with obvious UILabel leaks that are part of the xib structure that i custom built in IB. </p> <p>Can anyone point me to a solution here? Thanks...</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload