I have the next action.
- (IBAction)openThumbMap:(UIButton *) sender
{
ThumbmapViewController *viewController = [[ThumbmapViewController alloc] initWithInfo:mainPages];
viewController.title = self.title;
viewController.delegate = self;
[self presentModalViewController:viewController animated:YES];
[viewController release];
}
Simple, isn’t? Well… once I do [self dismissModalViewControllerAnimated:YES]; inside of the viewController, I go back but, the memory doesn’t release it. And the worse is, if I call it again, memory increase again. Why?
Inside of my viewController I create a lot of UIImageViews, which I release it after add these like subviews to the view of the viewController. So, if all of it are like subviews, must release it after dissmis the controller, isn’t?
The question is. Why the memory still increase it?
Edit:
Into my initWithInfo: method I set a NSArray property with the data from the parent viewController. With this array I create a bunch of small UIImages that I release when I finish my modal view controller.
It wasn’t the modal view controller itself, but the UIImage loaded inside. I discover that when you call
[UIImage imageNamed:@"blahblah.jpg"], iOS creates a cache, in case you are calling that image again. So, using[UIImage imageWithData:(NSData *)]is the answer for my bad-formulated question.