I have a problem, that caused me quite some hours/days of debugging so far.
My situation is:
I do not hold references (either weak or strong) for the modal view anywhere.
This is how the segue is performed:
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
UINavigationController *nav = [segue destinationViewController];
SomeViewController *vc = (SomeViewController *)[nav topViewController];
vc.dataArray = self.dataArray; // dataArray is a weak reference
}
And this is how i close it:
-(void)closeButtonClickHandler:(id)sender
{
[self dismissViewControllerAnimated:YES completion:nil];
}
In my viewDidDisapear method, i set everything to nil
- (void)viewDidDisappear:(BOOL)animated
{
[self.map removeAnnotations:self.myMap.annotations];
self.map.delegate = nil;
self.map = nil;
self.view = nil;
[super viewDidDisappear:animated];
}
But the controller still remains in memory. What is even worse is, that if i open it multiple times, it keeps adding to the consumed memory until eventually the OS is forced to close the application.
Any/all help is appreciated :)
I of found out that a small side view had a wrong reference set. It was 'strong', should have been 'weak'
@property (nonatomic, weak) UISomeView * someView;
After that the memory was released normally and did not stack up any more
tnx @JonathanCicohons for the hint :)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.