开发者

pushViewController causes memory leak

开发者 https://www.devze.com 2022-12-25 01:35 出处:网络
The Leaks application tells me that the following function开发者_开发技巧 is causing a memory leak and I can\'t figure out why.

The Leaks application tells me that the following function开发者_开发技巧 is causing a memory leak and I can't figure out why.

-(void)viewGameList {
GameListController *gameListViewController = [[GameListController alloc] initWithNibName:@"GameListController" bundle:nil];
gameListViewController.rootController = self;
[self.navigationController pushViewController:gameListViewController animated:YES];
[gameListViewController release];

}

It tells me that this line causes a 128 byte memory leak.

[self.navigationController pushViewController:gameListViewController animated:YES];

Am I missing something obvious?


One rule about iPhone memory management.

  • Child object must never retain its parent.

So, don't use retain in property declaration, use assign instead.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号