ClaretCache icon indicating copy to clipboard operation
ClaretCache copied to clipboard

YYCache webp 内存泄漏

Open ChenYilong opened this issue 5 years ago • 1 comments

来自 @政-打杂倒水-广州iOS :

说到YYCache。里面有一处过渡优化的 就是在释放menory cache的时候,它使用了子线程去释放。一般使用是没问题的。但是到了极端的情况下,CPU被拉满,子线程永远没有机会调用,然后主线程还一直往里面塞,最后内存爆炸被杀 当你们在一个页面大量使用webp的时候,就要留意了 在低端机比较容易出现,上下刷新的时候,容易出现 webp是一种新的图片格式,支持动态图片 另外动图可以关注一下svga,这个大小会小一点,但是cpu占用有时比较高

ChenYilong avatar Jul 17 '19 13:07 ChenYilong

来自 BM-成都iOS:

/**
If `YES`, the key-value pair will be released on main thread, otherwise on
background thread. Default is NO.

@discussion You may set this value to `YES` if the key-value object contains
the instance which should be released in main thread (such as UIView/CALayer).
*/
@property BOOL releaseOnMainThread;

/**
If `YES`, the key-value pair will be released asynchronously to avoid blocking 
the access methods, otherwise it will be released in the access method  
(such as removeObjectForKey:). Default is YES.
*/
@property BOOL releaseAsynchronously;

默认子线程。可以开启主线程

ChenYilong avatar Jul 18 '19 06:07 ChenYilong