ViewVillAppear で以下のように plist ファイルを読み込んでいます。最初のロードではリークはありませんが、他のタブバーボタン/アイテムを押してこのビューに戻るとリークが発生します。この NSMutableArray を dealloc でリリースしましたが、まだリークしています。その理由について少し混乱しています。(theProducts3 は、.h の ivar と同じように NSMutableArray であり、@property または保持されていません)
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
NSString *rootPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]; NSString *plistPath = [rootPath stringByAppendingPathComponent:@"basket.plist"];
theProducts3 = [[NSMutableArray alloc] initWithContentsOfFile:plistPath];
NSLog(@"Number of objects in item array %i", [theProducts3 count]);
}
ここで NSMutable 配列を解放します。
-(void)dealloc{
[theProducts3 release];
[super dealloc];
}
どんなポインタでも大歓迎です!ありがとう...