Reputation: 97
I have an app that transitions from view controller to view controller using the code below:
[self addChildViewController:self.aNewViewController];
[self transitionFromViewController:self.currentViewController
toViewController:self.aNewViewController
duration:1.0
options:UIViewAnimationOptionTransitionFlipFromBottom
animations:nil
completion:^(BOOL finished) {
[self.aNewViewController didMoveToParentViewController:self];
[self.currentViewController removeFromParentViewController];
self.currentViewController=self.aNewViewController;
}];
When I run it using Xcode 4.3 on an iOS 5.0 device, it runs very smoothly and uses about 30 - 50 mb. When i run it using Xcode 4.5 on any device it crashes as the app jumps from 30 - 70 - 100 - 130 mb each time I change View Controllers. It appears that the memory is not being released each time I leave a View Controller. I am using ARC.
Thanks in advance for any help you can provide.
Upvotes: 0
Views: 453
Reputation: 41642
Add a log message in dealloc() in each view controller involved here with some unique string and see if ANY VC involved in the transition is getting released. The one or ones not getting released are obviously the problem. Things to look for are retain cycles - ivars/properties of them that take a delegate or similar parameter that retains it. For example NSTimer retains the object it messages.
If you can find this, the solution is to code a new method in your VCs that prepares for release by insuring those objects are modified so as to not retain their owner (for a NSTimer, invalidate it then nil).
You can send this new message in the transitions completion block.
Upvotes: 1