Sdwebimage: What happens when disk memory is full.

Created on 9 Nov 2018  路  3Comments  路  Source: SDWebImage/SDWebImage

What happens when I keep writing to disk when the memory is full.
It will release cache?
it will crash?

usage

Most helpful comment

I think @MagLiC is referring to the disk, not the memory cache.
See #2366 - I think that is the error you get when disk is full.

All 3 comments

What happens when I keep writing to disk when the memory is full.

If you are writing disk cache using method like -[SDImageCache storeImage:forKey:completion:], you should note the documentation shows that this will also store the image into memory as well. So that the memory cache may start evicting. Because current implementation use NSCache.

In 4.x, we have no built-in method to store disk cache only. You can only use some hack way like using the internal method _storeImageDataToDisk:.

In 5.x, we introduce the SDImageCache protocol, which allows you to store disk cache only using storeImage:imageData:forKey:cacheType:completion: with SDImageCacheTypeDisk.

I think @MagLiC is referring to the disk, not the memory cache.
See #2366 - I think that is the error you get when disk is full.

That memory is full seems cause misunderstanding of this issue.

Was this page helpful?
0 / 5 - 0 ratings