Skip to content

Commit

Permalink
Fix RCTImageCache on macOS
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
appden authored and christophpurrer committed Jul 22, 2022
1 parent 84c0863 commit 1556e34
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Libraries/Image/RCTImageCache.m
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1556e34

Please sign in to comment.