调用popViewController时未释放内存 [英] Memory not released when popViewController Called

查看:120
本文介绍了调用popViewController时未释放内存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面是我有疑问的代码:-

Below is the code in which i have some doubts:-

MyController *vc= [MyViewController alloc] initWithNibName:@"myController"
                                                    bundle:nil];
[self.navigationController pushViewController:vc animated:YES];
[vc release];

然后,我通过按下导航栏上的后退按钮来弹出我的控制器.

Then, i pop my controller by pressing the back button on nav bar.

问题是内存第一次增加了5mb(在活动监视器上).当我弹出控制器时,它没有被释放. 而且当我进行一次推和弹出操作时,内存会少量增加,而内存也会减少.

The problem is memory is increased by 5mb(On Activity Monitor) for the first time.And when i pop the controller it doesnt get released. And when i do the push and pop again and again the memory increases by small amount and decreased too.

UIView * myView = [UIView alloc] init];

UIView *myView=[UIView alloc]init];

self.vi = myView;

self.vi=myView;

[myView版本];

[myView release];

UIScrollView * mySv = [UIScrollView alloc] init];

UIScrollView *mySv=[UIScrollView alloc]init];

self.sv = mySv;

self.sv=mySv;

[mySvrelease];

[mySvrelease];

UIProgressView * myPv = [UIProgressViewalloc] init];

UIProgressView*myPv=[UIProgressViewalloc]init];

self.pv = myPv;

self.pv=myPv;

[myPvrelease];

[myPvrelease];

UIWebView * myWv = [UIWebView alloc] init];

UIWebView *myWv=[UIWebView alloc]init];

self.wv = myWv;

self.wv=myWv;

[myWv版本];

[myWv release];

-(无效)取消分配 { [wv relase];

-(void)dealloc { [wv relase];

[sv版本]

[pv版本];

[vi版本];

[super dealloc];

[super dealloc];

}

wv,sv,pv,vi是具有保留属性的MyViewControoler变量. 我编写了这段代码来检查内存管理概念,但是现在看到活动监视器和工具结果令我感到困惑.

wv,sv,pv,vi are MyViewControoler variables which have retain attribute. I wrote this code to check the memory management concepts,but iam confused now seeing the activity monitor and instruments results.

我已经通过在其MyController类上验证没有任何对象泄漏到我的控制器中.

I have verified that no object is getting leaked in my MyController class by using Instruments on it.

推荐答案

MyViewController的内容会泄漏

MyViewController have a content which does a leaks

这篇关于调用popViewController时未释放内存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆