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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T14:47:41+00:00 2026-05-27T14:47:41+00:00

I had memory problems with an universal iOS application: CoreData was using too much

  • 0

I had memory problems with an universal iOS application: CoreData was using too much memory (> 30 Mo). Thus I did everything I could to reduce the amount of memory used.

Basically my CoreData model is a basic catalogue model:

  • high level categories (entity with limited binary data <10K)
  • each category has ~10 subcategories (entity with limited binary data <10K)
  • each subcategory has ~10 products (again, limited binary data <10K)
  • each product has ~10 detailed pictures (with a higher amount of data: ~40-70K)

After each item’s detailed item (including pictures) is deallocated, I do a

[NSManagedObjectContext refreshObject:item mergeChanges:NO];

call to reduce the in-memory graph (in order to skip pictures)

Things work pretty well with iOS 5+ but with iOS 4.3, I get many errors.

Sometimes, the error is :

Terminating app due to uncaught exception
‘NSObjectInaccessibleException’, reason: ‘The NSManagedObject with
ID:0xbb70480

has been invalidated.’

Other times, the app is killed with “handler threw exception” and no details on what went wrong.

My questions are :

  • Any idea why the behavior is different from iOS 5 and iOS 4.3?
  • Any recommandation on what I could do the reduce the memory used by CoreData? (other than releasing fetch controllers and releasing contexts that are not used anymore)
  • 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-27T14:47:42+00:00Added an answer on May 27, 2026 at 2:47 pm

    Hard to say the specific differences in memory usage w/ your model in different iOS versions. In my experience, storing images in a core data store doesn’t work particularly well. Generally, you want image data in memory only when needed. Each of your categories has ~4-7MB of image data so it won’t take too many categories before you run into problems. What I did in my app was store image data on disk and store the filename in the store. The image is only loaded when needed for display and it is released when no longer needed. This keeps the store small and fetches are fast.

    If you want to keep the image data in the store you should optimize as best you can. Configure all of your fetch requests to get all properties except the image data so that the image is faulted in when needed. You’ll also need to ensure the image data is turned back into a fault when not needed.

    EDIT: more info on why storing image data in core data is bad

    Another problem with using core data to store image data is that loading and saving the data, even if done only when needed, takes a non-trivial amount of time and will block your main thread while loading. Wherever you store the image data, you want to load it from the background. That’s simple if using a file store. If using core data, implement background image loading/saving logic that creates a new context, loads/saves the image data. When loading this would need to pass the data to the main thread so the UIImage can be created/displayed.

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

Sidebar

Related Questions

I already had some problems when I was using jQuery 1.4.2 (http://stackoverflow.com/questions/8158739/ie-memory-leak-and-eval-with-jquery/8176724#8176724) Now I've
We've had problems with memory leaks in our application. I've managed to replicate one
Due to some memory problems I had to textureBitmap.recycle() all texture bitmaps after I
Whilst developing for the iPhone I had a stubborn memory leak that I eventually
What memory leak detectors have people had a good experience with? Here is a
I had been wondering for quite some time on how to manager memory in
When I still had VS2005 there were a Memory and a Register panel available
I thought I had a pretty good handle on memory management for objective-c, but
I inherited an Intraweb app that had a 2MB text file of memory leaks
We're using EF4 in a fairly large system and occasionally run into problems due

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.