ibireme/YYImage

关于YYImage的缓存问题

diamondfive opened this issue · 0 comments

测试环境 xcode 9.4 iOS 11.4 6s上面
一个大小为20MB的gif图片 使用yyimage配合YYAnimatedImageView加载 内存稳定在31MB左右
代码如下
YYImage *image =[YYImage imageNamed:@"test.gif"]; YYAnimatedImageView *imageView = [[YYAnimatedImageView alloc] initWithImage:image]; imageView.frame = CGRectMake(100, 100, 300, 300); [self.view addSubview:imageView];

同样的gif图片使用imageWithSmallGIFData方式加载 内存会由31MB>>17MB维持稳定
代码如下
NSString *path =[[NSBundle mainBundle] pathForResource:@"test" ofType:@"gif"]; NSData *gifData =[NSData dataWithContentsOfFile:path]; UIImage *gif = [UIImage imageWithSmallGIFData:gifData scale:[UIScreen mainScreen].scale]; UIImageView *imageView2=[[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 300, 300)]; imageView2.image = gif; [self.view addSubview:imageView2];

YYImage 理论上应该不缓存数据,为何会出现上述情况?