From 73884be3673b6addde054ec1916e24c02718b6db Mon Sep 17 00:00:00 2001 From: Martin Conte Mac Donell Date: Thu, 17 Jan 2013 01:29:26 -0300 Subject: [PATCH] Invalid cost calculation when saving image to memory cache --- SDWebImage/SDImageCache.m | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/SDWebImage/SDImageCache.m b/SDWebImage/SDImageCache.m index 3b877319..0b76ef0a 100644 --- a/SDWebImage/SDImageCache.m +++ b/SDWebImage/SDImageCache.m @@ -179,7 +179,8 @@ static const NSInteger kDefaultCacheMaxCacheAge = 60 * 60 * 24 * 7; // 1 week if (diskImage) { - [self.memCache setObject:diskImage forKey:key cost:image.size.height * image.size.width * image.scale]; + CGFloat cost = diskImage.size.height * diskImage.size.width * diskImage.scale; + [self.memCache setObject:diskImage forKey:key cost:cost]; } dispatch_async(dispatch_get_main_queue(), ^