开发者

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.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜