我從來沒有遇到過這樣的問題..現在我不知道如何處理這個問題,並希望得到一些幫助。內存問題iphone
我推視圖控制器(讓我們說exampleViewController)導航控制器。在viewDidload的我的示例viewController中,我添加了一個imageview和一個圖像。在dealloc上,我從superview中刪除這個imageview,然後釋放任何保留的視圖。儀器泄漏工具不顯示任何泄漏,但是當我打開儀器 - 「活動監視器」,然後我看到,當我推我的exampleViewController真正的內存增加了5 MB,當我彈出我的exampleViewController,內存只減少3 MB ..所以如果我推動和彈出這個exampleViewController很多次,我得到一個內存警告,並在該應用程序退出。
我肯定是做錯了什麼,因爲其他視圖控制器的行爲如預期。所以問題是我不知道我做錯了什麼,並希望你們能夠提出一些我如何才能找出造成這種情況的方法。
我試圖像頁頭的工具儀器的一些工具,然後標記堆,還有一些類似的事情,但是,這並不表明什麼被泄露:/
在此先感謝!
編輯:
現在標誌着文書堆的時候似乎executeFetchRequest:漏水,難道我做錯了什麼?
+ (Question *)getQuestionWithId:(NSString *)questionId
{ 問題* resultQuestion = nil;
AppDelegate *appDelegate = (AppDelegate*)[UIApplication sharedApplication].delegate;
//geting context from appdelegate
NSManagedObjectContext *context = appDelegate.managedObjectContext;
//form fetch request with predicate
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
NSEntityDescription *entity = [NSEntityDescription entityForName:@"Question"
inManagedObjectContext:context];
NSPredicate *query = [NSPredicate predicateWithFormat:@"questionId=%@",questionId];
NSPredicate *query1 = [NSPredicate predicateWithFormat:@"type='ke'"];
NSPredicate *predicates = [NSCompoundPredicate andPredicateWithSubpredicates:[NSArray arrayWithObjects:query,query1, nil]];
[fetchRequest setPredicate:predicates];
[fetchRequest setEntity:entity];
NSError *error = nil;
NSArray *fetchedObjects = [context executeFetchRequest:fetchRequest error:&error];
[fetchRequest release];
resultQuestion = [fetchedObjects lastObject];
return resultQuestion;
}
如何以模態方式呈現視圖? – Bazinga 2012-07-24 14:10:42
所以你正在手動管理內存而不使用ARC,對嗎? – Lefteris 2012-07-24 14:10:58
是的,我手動管理內存.. @ Kobe.o4我需要推這個視圖控制器,呈現它modally不符合我的需要:/ – Lukas 2012-07-24 14:34:07