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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T13:13:33+00:00 2026-06-10T13:13:33+00:00

I have an app which caches large images so that user do not wait

  • 0

I have an app which caches large images so that user do not wait for imageWithContentsOfFile. As a general rule I cache a previous and next image.

1) Can I make this caching adaptive based on the available memory in iPad ? If yes what should be the threshold ? Below is the function to calculate the available memory

-(void) report_memory {
    struct task_basic_info info;
    mach_msg_type_number_t size = sizeof(info);
    kern_return_t kerr = task_info(mach_task_self(),
                                   TASK_BASIC_INFO,
                                   (task_info_t)&info,
                                   &size);
    if( kerr == KERN_SUCCESS ) {
        Log(@"Memory in use (in bytes): %u", info.resident_size);
    } else {
        Log(@"Error with task_info(): %s", mach_error_string(kerr));
    }
}

2) I know there is no way to (except the private/undocumented API) know the memory level warning, otherwise it could be a good factor to determine how many pages I can cache. But just to confirm can I use them in some way.

3) Right now I am thinking of caching 3 screens (which have 6 images) and in case my ViewController receive memory warning I unload all screens except the visible one and reset number of screens to cache to 2 (4 images). But I don’t found it optimized because either I am caching less than what is possible or in some conditions even loading 4 leads to crash.

  • 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-10T13:13:35+00:00Added an answer on June 10, 2026 at 1:13 pm

    If you are looking to cache as much data as possible without causing the application to crash, you can always make use of the function didReceiveMemoryWarning to remove excess caches when needed. Within this function, you don’t have to clear out everything. You could use it to selectively clear up enough room for the current situation and then continue caching until it fires off this warning again.

    An alternative would be to start a cache routine until the warning fires. This would allow you to create a count of items that were able to be cached. Once this count is reached, you could have your caching iterations stay far enough below that count to avoid issues.

    Not exactly an in-depth explanation, but these are some ideas for making use of the standard methods available that should still be able to achieve your goal.

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

Sidebar

Related Questions

I have an app that allows the user to cache data for offline use.
I have an app which has an SQLite database that is stored in ./Library/Caches
I have app in which i have recorded sound files i want that i
I have an app which contain some images in res/drawable/ and shows them in
I have an app which access an app folder on a per user basis.
I currently have an HTML5 web app that utilizes localstorage/websql/app cache. Now that the
I have developed iPhone app which contains a 80MB audio files and 20MB images
I have currently have a web application that caches a large amount of data
I have an app which operates a large quantity (~100) of bitmaps - i.e.
I have an ipad app which takes images from Photos application using ALAssetsLibrary and

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.