나는 좋은 시간 동안 내 아이폰 애플 리케이션에서 메모리 누수 문제에 붙어되었습니다. 내 데이터를 잘못 읽어야하는 것 같아. 메모리를 할당 할 때마다 너무 많은 오버 헤드로 인해 누출이 발생할 수 있습니다. 데이터를 릴리스 할 때 메모리 사용량이 거의 떨어지거나 전혀 떨어지지 않는 것 같습니다. 하나는 2 일 낭비했습니다 내 flipside보기 컨트롤러에서 UIWebview가 URL을로드하고 내 앱의 메모리 사용량이 3MB에서 7로 점프합니다. 내 dealloc 메서드에서 webview를 릴리스하지만 메모리의 거대한 블록은 아직 살아 있습니다. 아무도 제안이 없나요?아이폰 어리석은 메모리 누수
- (void)viewDidLoad {
self.view.backgroundColor = [UIColor viewFlipsideBackgroundColor];
nav_bar = [[UINavigationBar alloc] initWithFrame:CGRectMake(0,0,self.view.frame.size.width+20,45)];
[self.view addSubview:nav_bar];
[UINavigationBar release];
rightButton = [[UIBarButtonItem alloc] initWithTitle:@"Done" style:UIBarButtonItemStyleDone target:self action:@selector(done)];
item = [[UINavigationItem alloc] initWithTitle:@"Flipside View"];
item.rightBarButtonItem = rightButton;
item.hidesBackButton = YES;
[nav_bar pushNavigationItem:item animated:NO];
[rightButton release];
[item release];
NSAutoreleasePool *initPool = [[NSAutoreleasePool alloc] init];
web_view = [[UIWebView alloc]initWithFrame:CGRectMake(0,45,self.view.frame.size.width,self.view.frame.size.height - 45)];
web_view.autoresizesSubviews = YES;
web_view.autoresizingMask=(UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth);
NSString *urlAddress = @"http://www.tutorialpark.com/wpcontent/uploads/3/HeartBlending.jpg";
NSURL *url = [NSURL URLWithString:urlAddress];
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
[web_view loadRequest:requestObj];
[self.view addSubview:web_view];
[web_view release];
[initPool release];
[super viewDidLoad];
}
- (void)dealloc {
[nav_bar removeFromSuperview];
[web_view removeFromSuperview];
[rightButton release];
[super dealloc];
}
들여 쓰기에 대해 사과드립니다. 지금 당황스럽고 처리하고 싶지 않습니다.
Btw은 내가 시뮬레이터와 오토 릴리즈 풀을 내가 게시 할 때 내가 그 위에 보았다해야합니다 코드의 오래 된 조각에서 남은된다 – Daniel