我在iPad上有一個應用程序崩潰導致重新啓動。這種崩潰的方法showMap後會發生什麼地方:(Mappe * mappa):iPad應用程序崩潰導致重新啓動內存問題?
- (void)viewDidLoad {
moc = [[MapFetcher sharedInstance] managedObjectContext];
[NSThread detachNewThreadSelector:@selector(fetchMap) toTarget:self withObject:nil];
[super viewDidLoad];
}
- (void)fetchMap {
NSAutoreleasePool *threadPool = [[NSAutoreleasePool alloc] init];
Mappe *mappa;
mappa = [[[MapFetcher sharedInstance] fetchManagedObjectsForEntity:@"Mappe"
withPredicate:[NSPredicate predicateWithFormat:@"Citta == %@", map]
withDescriptor:@"Citta"] objectAtIndex:0];
[self performSelectorOnMainThread:@selector(showImage:) withObject:mappa waitUntilDone:YES];
[threadPool release];
}
- (void)showImage:(Mappe *)mappa {
imvMappa = [[UIImageView alloc] initWithFrame:CGRectMake(0.0, 0.0, 1024.0, 704.0)];
[imvMappa setImage:[UIImage imageWithData:[mappa Mappa]]];
[scrollView addSubview:imvMappa];
[scrollView setContentSize:CGSizeMake(1024.0, 704.0)];
[scrollView setMinimumZoomScale:0.5];
[scrollView setMaximumZoomScale:4.0];
[scrollView setZoomScale:1.0];
[scrollView setContentMode:(UIViewContentModeScaleAspectFit)];
[scrollView setClipsToBounds:YES];
[scrollView setDelegate:self];
[imvMappa release];
[loadingImage stopAnimating];
[waitFor setHidden:YES];
[scrollView setHidden:NO];
}
滾動視圖是一個出口,Mappe是管理對象,因爲我的應用程序在任何地方使用它,它應該工作正常,它不會造成麻煩。 我真的被卡住了,可能會導致crash-n-reboot?
編輯:內存分析
我用儀器 - 內存監視器,看看發生了什麼事情,並告訴在啓動的那一刻,我的應用程序使用17 MB的內存,而分配說:實時字節883 KB,總共4MB。我有點困惑......當我啓動上面的代碼時,我看到:2MB的實時字節(4個ViewControllers)總共22 MB,而Memory Monitor則說77 MB的實際內存。 我應該看到什麼情況的真實報告?