Is this a possible memory leak?
-(IBAction) btnLoginPressed{
Login *loginOver开发者_开发技巧View = [[Login alloc] initWithNibName:@"Login" bundle:nil];
[self.navigationController pushViewController:loginOverView animated:YES];
[loginOverView release];
}
loginOverView will never get released?
Why do you think it will never get released?
You have done the right thing by balancing the init with a release.
(in the second line the navigationController does retain login but it will release it itself when it is necessary)
You have released the object which you have taken ownership of through alloc
or new
. So according to the Memory Management guidelines you must release
it. So you have done the right thing.
精彩评论