Daily iOS
Memory and ARC

Using autoreleasepool

This code spikes memory and gets the app killed. What's the most appropriate fix?

for url in imageURLs {   // 5,000 of them
    let data = try Data(contentsOf: url)
    let image = UIImage(data: data)
    let thumb = image?.preparingThumbnail(of: size)
    save(thumb)
}

Pick one

Submit