我正在尝试查找我的应用程序中的内存泄漏。当应用程序加载时,我立即得到一个看起来像在仪器中的内存泄漏
我该如何调试?无论我运行我的应用程序多久或我做什么,它都不会自我复制,只有在应用程序加载时。
这是我在委托中的代码
- (void)applicationDidFinishLaunching:(UIApplication *)application
{
tabBarController = [[UITabBarController alloc] init];
search = [[iPhoneView alloc] initWithNibName:@"iPhoneView" bundle:nil];
homeNavigationController = [[UINavigationController alloc] initWithRootViewController:search];
favouritesNavigationController = [[UINavigationController alloc] init];
favoritesViewController = [[FavoritesViewController alloc]init];
[favouritesNavigationController pushViewController:favoritesViewController animated:NO];
aboutUsViewController =[[AboutUsViewController alloc] init];
UITabBarItem *item = [[UITabBarItem alloc] initWithTitle:@"toolbox" image:[UIImage imageNamed:@"aboutus"] tag:0];
aboutUsViewController.tabBarItem = item;
[item release];
UITabBarItem *item2 = [[UITabBarItem alloc] initWithTitle:@"αγαπημένα" image:[UIImage imageNamed:@"favorites"] tag:0];
favouritesNavigationController.tabBarItem = item2;
[item2 release];
NSArray *tabBarControllerCollection = [NSArray arrayWithObjects:homeNavigationController,favouritesNavigationController,aboutUsViewController,nil];
[tabBarController setViewControllers:tabBarControllerCollection animated:NO];
[window setRootViewController:tabBarController];
[tabBarControllerCollection release]; //added that for the leaks
//[window addSubview:tabBarController.view]; for the warning thing about window and root view controller
[window makeKeyAndVisible];
}
- (void)dealloc {
[tabBarController release];
[search release];
[favoritesViewController release];
[favouritesNavigationController release];
[aboutUsViewController release];
[window release];
[super dealloc];
}