I have a photo browsing app using UICollectionView and I used Kingfisher to download image from url like this:
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
...
cell.ivPhoto.kf.setImage
I debugged using xCode Profile tool and saw that when I scroll through the collection view, memory keep growing because of this object: ImageIO_jpeg_Data, and it linked to Kingfisher. Sometimes when scrolling through a collection view with large images (about 500KB each image), it's very laggy, memory could go up to 500+MB and the app crashed, I saw in lldb it was memory issue. I tried to set this:
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
ImageCache.default.clearMemoryCache()
}
but it didn't solve the crash issue.