의 UIViewController 클래스 ...Memorymanagement ... NSObject의 클래스에서 나는 다음과 같은 코드 누출 메모리 문제가
@property (nonatomic, retain) NSMutableArray *childrensArray;
-(void)connectionDidFinishLoading:(NSURLConnection *)connection {
NSLog(@"Connection finished loading.");
// Dismiss the network indicator when connection finished loading
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
// Parse the responseData of json objects retrieved from the service
SBJSON *parser = [[SBJSON alloc] init];
NSString *jsonString = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];
NSDictionary *jsonData = [parser objectWithString:jsonString error:nil];
childrensArray = [jsonData objectForKey:@"Children"];
// Callback to AttendanceReportViewController that the responseData finished loading
[attendanceReportViewController loadChildren];
[connection release];
[responseData release];
[jsonString release];
[parser release];
}
의 ViewController에서 다음 또한 메모리 누수에있는 NSMutableArray를 가져올 때
@property (nonatomic, retain) NSMutableArray *childrensArray;
- (void)loadChildren {
// Retrieve a array with dictionaries of children from ServiceGetChildren
self.childrensArray = [[serviceGetChildren.childrensArray copy] autorelease];
int total = [childrensArray count];
totalLabel.text = [NSString stringWithFormat:@"%d", total];
[theTableView reloadData];
}
게시자 코드를 삭제할 수 있습니까? – toto
방금 말했듯이, 당신의 누출 라인 ('childrensArray = [serviceGetChildren.childrensArray copy];''''대신'{')이 있습니다. 한 번에 붙여 넣기 복사 할 수 있지만 복사하여 붙여 넣을 수 있습니다. 레이아웃이 완전히 동일하면 더 많이 ... 아휴, 사물, 잘못이 있습니다. – Joetjah
@toto 물론 미안합니다. 이제는 더 읽기 쉬울 것입니다. – Silversnail