Note that there are some explanatory texts on larger screens.

plurals
  1. POMemory increasing on navigation, never decreasing. How can I decrease when view controller is popped?
    primarykey
    data
    text
    <p>In my program I have six view controllers. To navigate among these view controllers I used UINavigationController.</p> <p>I will explain this issue using two view controllers. In first view controller, I implemented a button action like this</p> <pre><code>- (IBAction)clickSearch:(id)sender{ [self gotoSearch]; } -(void)gotoSearch { NSArray *vc = [self.navigationController viewControllers]; ViewControllerSearch *vcSearch = nil; for (int i = 0; i &lt; [vc count]; i++) { UIViewController *tempVC = [vc objectAtIndex:i]; if ([tempVC isKindOfClass:[ViewControllerSearch class]]) { vcSearch = [vc objectAtIndex:i]; break; } } if (vcSearch) { //If exists inside stack the pop [self.navigationController popToViewController:vcSearch animated:YES]; } else { //If not exists inside stack push ViewController3 ViewControllerSearch *vc3New = [self.storyboard instantiateViewControllerWithIdentifier:@"vcsearch"]; [self.navigationController pushViewController:vc3New animated:YES]; vc3New = nil; } } </code></pre> <p>second view controller has a button and that button action is also implemented as above.</p> <p>if I move to second view controller from first view controller ,memory increasing.(its ok)</p> <p>if I move to first view controller from second view controller, memory level not changing.</p> <p>again I move to second view controller from first view controller ,memory increasing.you can see it in this image.</p> <p>(memory is not reducing)How can I reduced memory? <img src="https://i.stack.imgur.com/7GiyQ.png" alt="enter image description here"></p> <p>first time first to second : NSArray *vc has one object (first VC)</p> <p>second to first : NSArray *vc has two object (first VC,and second VC)</p> <p>now im in first view controller.now im click to move second view controller : NSArray *vc has only one object (first VC).second vc missing.and increasing memory (i think it for new second vc)</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload