图像无法在内存中释放

use*_*120 2 image ios memory-warning

我有图像单元格的表格.图像从互联网下载并保存在本地磁盘中.计数= 200.Tableview显示此图像.将内容滚动到底部时,会显示消息内存警告...已用内存250 - 300 mb O_O !!! 链接到不保留的图像.

NSString *cellID = @"cellId";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
...
NSString* imagePath = [arrayContent objectAtIndex:indexPath.row];
UIImage* image = [[UIImage alloc] initWithContentsOfFile:imagePath];
[cell.imageView setImage:image];
Run Code Online (Sandbox Code Playgroud)

为什么隐藏图像不释放?

Gan*_*thy 6

替换此行

UIImage* image = [[UIImage alloc] initWithContentsOfFile:imagePath];
Run Code Online (Sandbox Code Playgroud)

用这个并检查一次

 UIImage *image = [UIImage imageWithContentsOfFile:imagePath];
Run Code Online (Sandbox Code Playgroud)