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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:47:23+00:00 2026-05-23T15:47:23+00:00

I have a memory management vs user experience or just a silly question. Let’s

  • 0

I have a “memory management vs user experience” or just a silly question. Let’s imagine a UITabBarController based app with two tabs. While user is in 1st tab, a memory warnings arrives and 2nd tab’s view controller handles didReceiveMemoryWarning. Let’s also assume that 2nd tab has a pushed view controller. Questions:

  1. is it OK to manually pop VC in 2nd
    tab with
    popViewControllerAnimated: when
    memory warning is issued?
  2. Is it considered a bad UX or bad
    mem-mgmt idea? I think the user may
    be surprised with what he/she sees
    after switching back to 2nd tab, but
    if I don’t pop that VC the user will
    see just a blank screen. If user taps ‘Back’, 2nd tab VC will reload itself anyway (restart life-cycle with viewDidLoad: and it’s better than the app being killed by iOS).

The only flaw I see in above approach is when my pushed VC also pushed some VC. Then, the code would complicate… and if there was anything else pushed, it would complicate further leaving me with hard to maintain spaghetti code like that:

- (void)didReceiveMemoryWarning {
    UIViewController *pushedController = [self.navigationController visibleViewController];
    if ([pushedController isKindOfClass:[MyController class]]) {            
        // POP
        [self.navigationController popViewControllerAnimated:NO];
    } else {
        // MyController pushed something
        UIViewController *innerController = [pushedController.navigationController visibleViewController];
        if ([innerController isKindOfClass:[MyOtherController class]]) {
            [innerController.navigationController popViewControllerAnimated:NO];
            // Final POP
            [self.navigationController popViewControllerAnimated:NO];
        }
    }

    [super didReceiveMemoryWarning];
}

What’s your approach/advice? Maybe there’s already a simple approach for this and I overlooked it?

  • 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-23T15:47:24+00:00Added an answer on May 23, 2026 at 3:47 pm

    Any undefined behaviour would surely mean bad user experience. When your controller gets a memory warning the best approach would be to release any cached images, views(which are not in view), variables(not in use). You may want to design the app in such a way that memory management in the above scenario would not lead to undefined behaviour. Your app may not want to hog up all the memory and not know how to release it.

    It should be able to release the unwanted memory and handle the warning. You may want to specify what kind of data you are holding inorder to get a more specific response here.

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

Sidebar

Related Questions

I'm developing an iPhone app and have a question about memory management. Let's say
I have a question about variable scope and memory management in C. I am
I have a question regarding AS3 memory management I wonder if anyone could help
My app uses XML to save user data to a file. I have just
I am confused by the memory management in this scenario. In my app user
I have a C++ memory management doubt, that's (obviously) related to references and pointers.
i thought i getting the hang of Cocoa memory management, but apperently i have
I have some questions about using MySQLi queries, and related memory management. Suppose I
Two Windows processes have memory mapped the same shared file. If the file consists
I have a little problem with memory management in a Windows Service written in

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.