IOS controller memory not freed after firing

When the user clicks the button, he introduces a new tab bar display controller with two view controllers. This is how i do it

ACLevelDownloadController *dvc = [[ACLevelDownloadController alloc] initWithNibName:@"ACLevelDownloadController" bundle:[NSBundle mainBundle]]; ACInstalledLevelsController *ivc = [[ACInstalledLevelsController alloc] initWithNibName:@"ACInstalledLevelsController" bundle:[NSBundle mainBundle]]; UITabBarController *control = [[UITabBarController alloc] init]; control.viewControllers = @[dvc, ivc]; dvc.tabBarItem = [[UITabBarItem alloc] initWithTabBarSystemItem:UITabBarSystemItemFeatured tag:0]; ivc.tabBarItem = [[UITabBarItem alloc] initWithTabBarSystemItem:UITabBarSystemItemDownloads tag:1]; [self presentViewController:control animated:YES completion:nil]; 

this works great. I reject this view controller using the dismiss method dismiss both ACLevelDownloadController and ACInstalledLevelsController . This also works great. What is strange is that memory usage increases when I present a controller of the form enter image description here

but he never returns. If I send it again, it will be even larger enter image description here I am using ARC. Why is the memory used by view controllers not freed after they are rejected?

EDIT

As they are rejected, both ACLevelDownloadController and ACInstalledLevelsController connected by IBActions that call this method when pressed

 - (void)dismiss:(id)sender{ [self dismissViewControllerAnimated:YES completion:nil]; } 
+7
source share
1 answer

What we can observe from the graph of memory usage is that the tabViewController is not cleaned properly and it is created on the stack. Upon termination, you must allow the viewController that the tabViewController introduced to reject it. He must fire. Also keep weak links for Outlets and assign any strong links to nil ** in viewWillDisapper:. You can present viewController modally as a temporary interrupt for receiving important information from the user. If this is not the case, you can delete the presentation modally. Check out the link. Hope this helps :)

+2
source

All Articles