gpt4 book ai didi

android - 最佳内存缓存技术

转载 作者:行者123 更新时间:2023-11-30 01:51:15 25 4
gpt4 key购买 nike

我一直在浏览安卓开发者网站 Displaying Bitmaps Efficiently .

但我对以下陈述感到困惑,需要有关良好内存缓存技术的建议。以下是链接。

http://developer.android.com/training/displaying-bitmaps/cache-bitmap.html

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.

那么 LRU Cache 是比弱引用/软引用最好的技术吗?为什么会这样?还有如何针对不同的 Android 设备版本管理相同的技术?

请帮助我并建议最好的技术。

最佳答案

即使文档没有提到这一点。我们不处理缓存或回收位图的开销它是通过使用第三方[受信任和广泛使用] 工具处理的,例如 picasso 或 glide 或通用图像加载器。请阅读此信息,但很多应用程序都使用这些

关于android - 最佳内存缓存技术,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33014777/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com