ios - Does dismissViewControllerAnimated:completion: retain previous view controllers? -


i having memory leaks , crashes in app , know if due way container view controller switches between view controllers. app should allow user navigate long series of pages. each page laid out viewcontroller in storyboard (each page has number identifier).

by time page 14 in app, can see in instruments' activity monitor app takes 600mb of memory (on ipad 3). because each view controllers have uiimageviews big images.

i using arc.

below code container view controller. can see memory management problem somewhere?

@implementation pagenavigator  int startingpage = 0; int currentpage = 0;  -(void)viewdidappear:(bool)animated{     nslog(@"starting book page %d", startingpage);      //do first time app runs     if(startingpage != -1){         uiviewcontroller *currentpagevc = [self.storyboard instantiateviewcontrollerwithidentifier:[nsstring stringwithformat:@"%d", startingpage]];         [self presentmodalviewcontroller:currentpagevc animated:yes];         currentpage = startingpage;         startingpage = -1;     } }  //currentpagevc , outlets should released when gets out of scope, right?  -(ibaction)gotonextpage{     [self dismissviewcontrolleranimated:yes completion:^{          currentpage++;         uiviewcontroller *currentpagevc = [self.storyboard instantiateviewcontrollerwithidentifier:[nsstring stringwithformat:@"%d", currentpage ]];         [self presentmodalviewcontroller:currentpagevc animated:yes];          nslog(@"current page %d", currentpage);      }]; } 

when dismissviewcontrolleranimated called control goes dealloc method of controller, if not using arc , allocating memory ui controls need release those, , won't need take care of view controller's memory.


Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c# - Copy ObservableCollection to another ObservableCollection -

All overlapping substrings matching a java regex -