From 7704c1e5b5594ba353b4b53632cfcf53921105dd Mon Sep 17 00:00:00 2001 From: DreamPiggy Date: Thu, 4 Jan 2018 20:09:18 +0800 Subject: [PATCH] Remove the extra memory warning notification for AutoPurgeCache --- SDWebImage/SDImageCache.m | 27 +-------------------------- 1 file changed, 1 insertion(+), 26 deletions(-) diff --git a/SDWebImage/SDImageCache.m b/SDWebImage/SDImageCache.m index e7c84957..a8021e66 100644 --- a/SDWebImage/SDImageCache.m +++ b/SDWebImage/SDImageCache.m @@ -11,31 +11,6 @@ #import "NSImage+WebCache.h" #import "SDWebImageCodersManager.h" -// See https://github.com/rs/SDWebImage/pull/1141 for discussion -@interface AutoPurgeCache : NSCache -@end - -@implementation AutoPurgeCache - -- (nonnull instancetype)init { - self = [super init]; - if (self) { -#if SD_UIKIT - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(removeAllObjects) name:UIApplicationDidReceiveMemoryWarningNotification object:nil]; -#endif - } - return self; -} - -- (void)dealloc { -#if SD_UIKIT - [[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationDidReceiveMemoryWarningNotification object:nil]; -#endif -} - -@end - - FOUNDATION_STATIC_INLINE NSUInteger SDCacheCostForImage(UIImage *image) { #if SD_MAC return image.size.height * image.size.width; @@ -90,7 +65,7 @@ FOUNDATION_STATIC_INLINE NSUInteger SDCacheCostForImage(UIImage *image) { _config = [[SDImageCacheConfig alloc] init]; // Init the memory cache - _memCache = [[AutoPurgeCache alloc] init]; + _memCache = [[NSCache alloc] init]; _memCache.name = fullNamespace; // Init the disk cache