解决SD加载过多过大图片导致内存爆表崩溃的问题

解决SDWebimage加载过多过大图片导致内存爆表崩溃的问题

- (void)imageLoadingSettings {
   [SDImageCache sharedImageCache].config.maxCacheAge = 3600 * 24 * 7;
   [SDImageCache sharedImageCache].maxMemoryCost = 1024 * 1024 * 20;   
   [SDImageCache sharedImageCache].config.shouldCacheImagesInMemory = NO;//是否缓存到内存中 默认是 YES
   [SDImageCache sharedImageCache].config.shouldDecompressImages = NO;//是否解压图像 默认是 YES
   [SDWebImageDownloader sharedDownloader].shouldDecompressImages = NO;
   [SDImageCache sharedImageCache].config.diskCacheReadingOptions = NSDataReadingMappedIfSafe;
}

推荐阅读更多精彩内容