From 1556e3484f5926ed28e10a4058071c0154068101 Mon Sep 17 00:00:00 2001 From: Scott Kyle Date: Tue, 1 Jun 2021 16:02:54 -0700 Subject: [PATCH] Fix RCTImageCache on macOS The cache's `totalCostLimit` and the `_cacheStaleTimes` ivar were not getting set for Mac, presumably due to a merge mistake. I'm not sure what (if any) positive impact this will realistically have on memory consumption. Tested rn-tester scrolling through several threads with lots of images. Everything works well. --- Libraries/Image/RCTImageCache.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Libraries/Image/RCTImageCache.m b/Libraries/Image/RCTImageCache.m index bc0ec68ff05c4e..1a82e291885e9a 100644 --- a/Libraries/Image/RCTImageCache.m +++ b/Libraries/Image/RCTImageCache.m @@ -38,10 +38,10 @@ - (instancetype)init { if (self = [super init]) { _decodedImageCache = [NSCache new]; -#if !TARGET_OS_OSX // TODO(macOS GH#774) _decodedImageCache.totalCostLimit = 20 * 1024 * 1024; // 20 MB _cacheStaleTimes = [NSMutableDictionary new]; +#if !TARGET_OS_OSX // TODO(macOS GH#774) [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(clearCache) name:UIApplicationDidReceiveMemoryWarningNotification