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 7773153
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T17:03:54+00:00 2026-06-01T17:03:54+00:00

Why do I have a memory leaking with ARC enabled(highlighted in bold)? I have

  • 0

Why do I have a memory leaking with ARC enabled(highlighted in bold)?

I have CustomCell.m

   +(CustomCell*)cell
{


    if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
        NSArray *nib =[[NSBundle mainBundle] loadNibNamed:@"CustomCell_iPhone" owner:self options:nil];         
        return [nib objectAtIndex:0];

    } else {
        NSArray *nib =[[NSBundle mainBundle] loadNibNamed:@"CustomCell_iPad" owner:self options:nil];          **//leaking 100%**  
        return [nib objectAtIndex:0];

    }
}

In my tableview conteroller:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    cell=[CustomCell cell]; **// 100% leaking**
...
}
  • 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-06-01T17:03:55+00:00Added an answer on June 1, 2026 at 5:03 pm

    So, two things. One, I gather you’re creating this cell in a .xib file. Set the reuse identifier on the cell in IB. Then, instead of this CustomCell class method, unload the nib in tableView:cellForRowAtIndexPath:, like this:

    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
        // Assuming you set a reuse identifier "cellId" in the nib for your table view cell...
        MyCell *cell = (MyCell *)[tableView dequeueReusableCellWithIdentifier:@"cellId"];
        if (!cell) {
            // If you didn't get a valid cell reference back, unload a cell from the nib
            NSArray *nibArray = [[NSBundle mainBundle] loadNibNamed:@"MyCell" owner:nil options:nil];
            for (id obj in nibArray) {
                if ([obj isMemberOfClass:[MyCell class]]) {
                    // Assign cell to obj, and add a target action for the checkmark
                    cell = (MyCell *)obj;
                    break;
                }
            }
         }
    
         return cell;
    }
    

    The second thing is that by trying to dequeue a reusable cell first, you will get much much better performance.

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

Sidebar

Related Questions

im new with objective-c. I have problem with memory leaking when developing iphone app.
I have written an application that is leaking memory - I've done the following
I have problem with the following code leaking memory... @property (nonatomic, retain) NSMutableArray *childrensArray;
I have found a line of code that is leaking memory in my project.
I have a webpage that's leaking memory in both IE8 and Firefox; the memory
I have a Java application that is leaking memory. I know which objects are
Two Windows processes have memory mapped the same shared file. If the file consists
Does gcc have memory alignment pragma, akin #pragma vector aligned in Intel compiler? I
I am trying to load an image in memory but might have memory issues
Ignoring unsafe code, .NET cannot have memory leaks. I've read this endlessly from many

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.