와 객체를 해제 : cellForRowAtIndexPath는 : 목표 C 누출 내가있는 tableView에 다음 코드를 실행하고있는 UITableViewCell
File *file = [[File alloc] init];
file = [self.fileList objectAtIndex:row];
UIImage* theImage = file.fileIconImage;
cell.imageView.image = theImage;
cell.textLabel.text = file.fileName;
cell.detailTextLabel.text = file.fileModificationDate;
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
return cell;
나는 누수 도구를 실행하고 나는 그것을 공개하고 있지 않다 때문에 File 객체가 누출되는 것을 발견했다. (아래 그림 참조) 나는 그것이 안전하다고 생각 어디 그래서 이전 셀을 반환에 자료를 추가 :
File *file = [[File alloc] init];
file = [self.fileList objectAtIndex:row];
UIImage* theImage = file.fileIconImage;
cell.imageView.image = theImage;
cell.textLabel.text = file.fileName;
cell.detailTextLabel.text = file.fileModificationDate;
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
[file release];
return cell;
을 지금, 나는 그것이 충돌 응용 프로그램을 실행할 때. UITableViewCells가 여전히 파일 객체를 참조합니까? 내가 메모리를 누출하지 않도록 여기에서 사용하는 접근법은 무엇입니까?
페어를 작성하는 것을 의미, 그 비트에보고하지 않았다/초기화 ALLOC를 가진 오토 릴리즈를 제안 만했다 ...하지만, 그는 바로 필요로하지 않는 것 파일 객체를 할당/초기화하는 것! – h4xxr