我一直卡在我的iPhone應用程序的內存泄漏問題現在很好。我覺得我必須錯誤地閱讀我的數據。似乎每當我分配內存的時候,有太多開銷導致泄漏,當我釋放數據時,內存使用量幾乎沒有下降或根本沒有下降。一個已經浪費了2天是我的flipside視圖控制器上的UIWebview加載一個url,我的應用程序的內存使用從3 MB跳到7.我在我的dealloc方法中釋放webview,但巨大的內存塊仍然存在。有沒有人有任何建議。iPhone荒謬的內存泄漏
- (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];
}
我對縮進表示歉意我非常生氣,不想處理它。
順便說一句我看到這些泄漏在模擬器和真實設備 – Daniel