缓冲Bitmaps

来源:互联网 发布:刘诗诗婚纱同款 淘宝 编辑:程序博客网 时间:2024/05/22 06:59

最近在看Android Develop SDK,在讲Bitmap的缓冲时,我看到下面的这段话:

Note: In the past, a popular memory cache implementation was a SoftReference or WeakReference bitmap cache, however this is not recommended. Starting from Android 2.3 (API Level 9) the garbage collector is more aggressive with collecting soft/weak references which makes them fairly ineffective. In addition, prior to Android 3.0 (API Level 11), the backing data of a bitmap was stored in native memory which is not released in a predictable manner, potentially causing an application to briefly exceed its memory limits and crash.


SDK不再推荐SoftReference或者WeakReference来做Bitmap的缓冲,而是推荐LruCache来实现Memory Cache,另外SDK还提到,Memory Cache可以结合Disk Cache来实现更好的效果

原创粉丝点击