This is a very simple test code to debug a very mystifying leak. When I run this code using Xcode's leak tool I get two leak objects ( _NSArrayM). The commented line below shows my leak source but I just fail to understand why I get this leak. All allocs in this code have been properly released.
Only way I can get rid of the leak is if I build my viewcontrollers using Interface Builder.
Any clue will be greatly appreciated. I am sure I am missing something very simple here. Anybody any ideas??
P.S using SDK 4.0
- (BOOL)application

UIApplication *)application didFinishLaunchingWithOptions

NSDictionary *)launchOptions {
// Override point for customization after application launch.
UIViewController *VC1 = [[UITableViewController alloc]initWithStyle:UITableViewStylePlain];
VC1.title =@"First";
UINavigationController *nvc1 =[[UINavigationController alloc]init];
[nvc1 initWithRootViewController:VC1]; // Source of LEAK 1 !!!
UIViewController *VC2 = [[UITableViewController alloc]initWithStyle:UITableViewStylePlain];
VC2.title =@"Second";
UINavigationController *nvc2 =[[UINavigationController alloc]init];
[nvc2 initWithRootViewController:VC2]; // Source of LEAK 2 !!!
// Add the tab bar controller's view to the window and display.
tabBarController.viewControllers = [NSArray arrayWithObjects:nvc1,nvc2, nil];
[nvc1 release];
[nvc2 release];
[VC1 release];
[VC2 release];
// Add the tab bar controller's view to the window and display.
[window addSubview:tabBarController.view];
[window makeKeyAndVisible];
return YES;
}