I have a navigation controller, which loads a UITableviewcontroller (DOArticleListViewController):
- (void) showList: (NSFetchedResultsController*) list title:(NSString*) title {
DOArticleListViewController* listView = [[[self navigationController] storyboard] instantiateViewControllerWithIdentifier:@"DOArticleListViewController"];
[listView setObjects:list];
[listView setViewTitle:title];
[[self navigationController] pushViewController:listView animated:YES];
}
When I tap the 'Back' button in the DOArticleListViewController the view is not released (no dealloc/viewDidUnload), and the memory usage increases every time I go back and forward.
What can be the reason, or how can I force it to release? I might have something to do with the "NSFetchedResultsController", as I only recently moved to ARC.
The declaration of the TableViewController is:
@interface DOPrototypeListViewController : DOPrototypeViewController <NSFetchedResultsControllerDelegate, UITableViewDelegate> {
IBOutlet UITableView * _tableView;
int _cellHeight;
@protected
NSFetchedResultsController* _objects;
NSString* _cellIdentifier;
bool _commonId;
int _sectionItemsSkipped;
}
@property (nonatomic, strong) UITableView *tableView;
@property (nonatomic, strong) NSFetchedResultsController* objects;
- (NSIndexPath*)calculateObjectIndexPath:(NSIndexPath*) indexPath;
- (NSIndexPath*)calculateTableIndexPath:(NSIndexPath*) indexPath;
@end
I declared the list as strong, as if I make it weak, the NSFetchedResultsController is unloaded when I am looking for the objects when going to the subsequent detailViewController.
EDIT: I think I might have a more fundamental problem, as profiling it seems no objects are ever released. Even if the retain count is 0, the object seems to stay in memory. I moved to ARC during the summer, and did an automatic conversion. I just wonder if I have a simple fundamental flaw somewhere which causes objects to be retained and never released/dealloc.
Do objects which are instantiated in the class itself to be set to nil? e.g. do I need to set this to nil:
_mediaPlayerHelper = [[DOMediaPlayerHelper alloc] init:self];
Before ARC I would have done that, but now I have no function which is called when a view controller is removed form the view-stack (and can be removed, but this is only when going back up a level, not when gong to a detail view controller).