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

  • SEARCH
  • Home
  • 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 909167
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T16:49:58+00:00 2026-05-15T16:49:58+00:00

I have a memory leak while using NSFetchedResultsController objectAtIndex: The stack frame is as

  • 0

I have a memory leak while using NSFetchedResultsController objectAtIndex:
The stack frame is as follow:

   0 CoreFoundation __CFDataAllocate
   1 CoreFoundation __CFDataInit
   2 CoreData -[NSSQLCore _prepareResultsFromResultSet:usingFetchPlan:withMatchingRows:]
   3 CoreData -[NSSQLCore _newRowsForFetchPlan:selectedBy:withArgument:]
   4 CoreData -[NSSQLCore newRowsForFetchPlan:]
   5 CoreData -[NSSQLCore objectsForFetchRequest:inContext:]
   6 CoreData -[NSSQLCore executeRequest:withContext:error:]
   7 CoreData -[NSPersistentStoreCoordinator executeRequest:withContext:error:]
   8 CoreData -[NSManagedObjectContext executeFetchRequest:error:]
   9 CoreData _faultBatchAtIndex
  10 CoreData -[_PFBatchFaultingArray objectAtIndex:]
  --->  11 MyApp -[DocumentViewController tableView:heightForRowAtIndexPath:] 
  12 UIKit -[UISectionRowData refreshWithSection:tableView:tableViewRowData:]
  13 UIKit -[UITableViewRowData rectForFooterInSection:]
  14 UIKit -[UITableViewRowData heightForTable]
  15 UIKit -[UITableView(_UITableViewPrivate) _updateContentSize]
  16 UIKit -[UITableView noteNumberOfRowsChanged]
  17 UIKit -[UITableView reloadData]
  18 UIKit -[UITableView layoutSubviews]
  19 QuartzCore -[CALayer layoutSublayers]
  20 QuartzCore CALayerLayoutIfNeeded
  21 QuartzCore CA::Context::commit_transaction(CA::Transaction*)
  22 QuartzCore CA::Transaction::commit()
  23 QuartzCore CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*)
  24 CoreFoundation __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__
  25 CoreFoundation __CFRunLoopDoObservers
  26 CoreFoundation __CFRunLoopRun
  27 CoreFoundation CFRunLoopRunSpecific
  28 CoreFoundation CFRunLoopRunInMode
  29 GraphicsServices GSEventRunModal
  30 GraphicsServices GSEventRun
  31 UIKit UIApplicationMain

From this stack frame, it looks like the object accessed with objectAtIndex get leaked.

However, when I leave the controller, its dealloc method get called. In this method, all the objects fetched by the fetchedresultscontroller are turned into fault since I use [NSManagedObjectContext refreshObject:mergeChange].

To be complete in my description, below is the code where the leaking object is created:

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    Page* page = [[self fetchedResultsController] objectAtIndexPath:indexPath];
    UIImage* thumbnail = [page getThumbnail];
    [[self managedObjectContext] refreshObject:page.image mergeChanges:NO];
    CGFloat height = [PageCell cellImageSize:thumbnail].height + 20;
    return height;
}

Any hint would be appreciated,
Thanks!

  • 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-15T16:49:59+00:00Added an answer on May 15, 2026 at 4:49 pm

    Check the code where you get the UIImage. The leak is most likely there. Where it is exactly depends on how you create the image object.

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

Sidebar

Related Questions

I have just discovered a nasty memory leak using both each_array() and each_arrayref() from
I have been looking into a memory leak issue for a while. I found
I´m new in iPhone development and I have this memory leak. I´m using an
I have a memory leak in my iOS app which sometimes causes it to
I have a memory leak on one of the part of my node.js application.
I have a memory leak from 3 UIImages the problem is I can't just
I have a problem with a memory leak. I have this code in a
I have a problem with a memory leak in a very large ASP.NET application.
I have successfully debugged my own memory leak problems. However, I have noticed some
I have a static std::vector in a class. When I use Microsoft's memory leak

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.