Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 595421
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T16:03:37+00:00 2026-05-13T16:03:37+00:00

I found a memoryleak using instruments in one of my TableView, exactly at the

  • 0

I found a memoryleak using instruments in one of my TableView, exactly at the line:

[[NSBundle mainBundle] loadNibNamed:@"ShopListCell" owner:self options:NULL];

The Identifier from the nib ShopListCell wasn’t correct with the CellIdentifier.

Now, I don’t have memory-leaks, but my UITableViewCells have their own-life 🙂

I’m using a custom UITableViewCell, and I show some image and update some labels from a NSFetchedResultsController.

When the user clicks in one row, I update the model, so the cell has always the real data to show, but, instead of showing the real data, it shows some other cell.

I suspect this is because I’m reusing cells, but I make all the modifications to the cell before returning it, so I expect to show always the correct data.

This was perfect before fixing the memory-leak, I was using always a new cell, now I’m reusing them but with lots of problems.

The [cell setNeedsDisplay]; before returning the cell has no effect.

Here is some code:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

static NSString *CellIdentifier = @"ShopListCell";

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];

[[NSBundle mainBundle] loadNibNamed:@"ShopListCell" owner:self options:NULL];
cell = nibLoadCell;

cell.backgroundColor = [UIColor clearColor];

}

// Set up the cell...

Ingredient *ingredient = (Ingredient *)[fetchedResultsController objectAtIndexPath:indexPath];

NSLog(@"Section %d Row %d ingredient: %@", indexPath.section, indexPath.row,ingredient.name); // just to be sure it fetchs the correct data, and it does


if([ingredient.isInListDone intValue] == 0) {
cell.accessoryType = UITableViewCellAccessoryNone;
[cellStateButton setSelected:NO];
cellImageInList = nil;

}
else {
cell.accessoryType = UITableViewCellAccessoryCheckmark;
[cellStateButton setSelected:YES];
cellImageInList.image = [UIImage imageNamed:@"underlined2.png"];

}

cellLabelName.text = [ingredient name];

 [cell setNeedsDisplay]; // this line has NO effect

return cell;
}

Also I’ve put a NSLog and it fetches the correct data at correct section and row …

thanks,

r.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T16:03:37+00:00Added an answer on May 13, 2026 at 4:03 pm

    After reading the other post, finally I’ve set-up a new class with my custom-cell and now al works as expected, an no memory-leaks!

    thanks,

    r.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have checked using instruments and not found any memory leaks. when i check
Anybody found yet a good web site architecture using linq to sql? Any help
I found a very interesting memory leak detector by using Visual C++. http://www.codeproject.com/KB/applications/visualleakdetector.aspx I
I'm using a function I found here to save a webpage to memory with
I've found several jQuery syntaxes for nullifying the enter on a form. First one:
Found some old code, circa VS 2003. Now I have just VS 2008 (SP1)
Found the following in an Oracle-based application that we're migrating (generalized) : SELECT Table1.Category1,
I found this open-source library that I want to use in my Java application.
I found What are mvp and mvc and what is the difference but it
I found a bug in the Contains statement in Linq (not sure if it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.