We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
我现在用fresco加载一个列表,列表每一个item都是一张图片,加载到大概10页面左右,就使用了200M左右的内存,这个内存可以通过回收控制吗,怎样优化?
The text was updated successfully, but these errors were encountered:
你测试机是5.0以上系统吧,5.0以上系统 需要配置一下,不能无限制使用内存缓存
我是这样配置的:
public class LollipopBitmapMemoryCacheParamsSupplier implements Supplier {
private ActivityManager activityManager; public LollipopBitmapMemoryCacheParamsSupplier(ActivityManager activityManager) { this.activityManager = activityManager; } @Override public MemoryCacheParams get() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { return new MemoryCacheParams(getMaxCacheSize(), 56, Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE); } else { return new MemoryCacheParams( getMaxCacheSize(), 256, Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE); } } private int getMaxCacheSize() { final int maxMemory = Math.min(activityManager.getMemoryClass() * ByteConstants.MB, Integer.MAX_VALUE); if (maxMemory < 32 * ByteConstants.MB) { return 4 * ByteConstants.MB; } else if (maxMemory < 64 * ByteConstants.MB) { return 6 * ByteConstants.MB; } else { if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.GINGERBREAD) { return 8 * ByteConstants.MB; } else { return maxMemory / 4; } } }
}
Sorry, something went wrong.
@tianlang 可以问一下你为什么要这样配置么? MemoryCacheParams的cacheEntries为什么要设置56和256?
aagnes-zz
No branches or pull requests
我现在用fresco加载一个列表,列表每一个item都是一张图片,加载到大概10页面左右,就使用了200M左右的内存,这个内存可以通过回收控制吗,怎样优化?
The text was updated successfully, but these errors were encountered: