【发布时间】:2011-02-01 15:32:54
【问题描述】:
Leaks 应用程序告诉我以下函数导致内存泄漏,我不知道为什么。
-(void)viewGameList {
GameListController *gameListViewController = [[GameListController alloc] initWithNibName:@"GameListController" bundle:nil];
gameListViewController.rootController = self;
[self.navigationController pushViewController:gameListViewController animated:YES];
[gameListViewController release];
}
它告诉我这一行会导致 128 字节的内存泄漏。
[self.navigationController pushViewController:gameListViewController animated:YES];
我是否遗漏了一些明显的东西?
【问题讨论】:
-
属性
.rootController是如何声明的? -
我不确定代码是否会在评论中正确显示,但这是 GameListController.m 对您问题的回答:@class RootViewController; @interface GameListController : UIViewController { RootViewController *rootController; @property (nonatomic, 保留) RootViewController *rootController;关于为什么我会在这里出现内存泄漏的任何想法?
标签: iphone memory-leaks uinavigationcontroller