아래 라인이 메모리 누수가되는 이유는 무엇입니까? cellForRowAtIndexPath 메소드 내 왜이 라인에 메모리 누수가 있습니까?
cell.imageView.image = [UIImage imageWithData:[NSData dataWithContentsOfURL:person.imageURL]];
: 여기
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"PersonCell"];
if (cell == nil){
cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:@"PersonCell"] autorelease];
}
Person *person = [[Person alloc] initWithUserName:[people objectAtIndex:indexPath.row]];
cell.imageView.image = [UIImage imageWithData:[NSData dataWithContentsOfURL:person.imageURL]];
cell.textLabel.text = [people objectAtIndex:indexPath.row];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
[person release];
return cell;
}
그리고는 person.m에서 관련 방법이다
- (NSURL*) imageURL
{
return [NSURL URLWithString:[userInfo valueForKey:@"profile_image_url"]];
}
편집 : 추가 초기화 방법 만
- (id)initWithUserName:(NSString *)user{
userName = [user copy];
userInfo = [[TwitterHelper fetchInfoForUsername:userName] retain];
updates = [[TwitterHelper fetchTimelineForUsername:userName] retain];
return self;
}
누출이 있다는 것을 어떻게 압니까? –
제이슨이 말했듯이; 어떻게 유출되었다고 판단 했습니까? 어떤 도구를 사용 했습니까? – bbum
저는 장비에서 누출을 감시하고 있습니다. 그것이 도구가보고하는 것입니다. – Jason