Simple scenario: table view controller, with 5.000 rows. I have 5000 images name from 0.png to 4999.png.
Here is my cellForRowAtIndexPath: method :
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
NSString *string = [NSString stringWithFormat:@"%d",indexPath.row];
UIImage *img = [UIImage imageNamed:string];
if (img) {
cell.imageView.image = img;
} else {
cell.imageView.image = [UIImage imageNamed:@"NoPhotoDefault"];
}
return cell;
I've analized the behaviour whit instruments, and it indicates that real memory usage is rising fast at scrolling and it never goes down.
It start from about 8 MB and it goes up to 200 MB when reaching last row.
What am i missing here?
Thanks
P.S. Proj base sdk is 5.0, and using ARC.
Later edit, when sending the app in background, memory is freed.