我正在使用 Glide 加载位图以创建 gif。
for (int i = 0, count = files.size(); i < count; i++) {
Bitmap img = Glide.with(context)
.load(files.get(i))
.asBitmap()
.centerCrop()
.into(GIF_EXPORT_SIZE / 2, GIF_EXPORT_SIZE / 2)
.get();
// addFrame creates a copy of img, so we can re-use this bitmap
encoder.addFrame(img);
}
我想知道谁负责回收这个 Bitmap 或把它放回 Glide BitmapPool?Glide 似乎没有办法自动或使用clear()
.
我查看了使用类似的方法将位图直接添加回池中,Glide.get(context).getBitmapPool().put(img)
但根据文档,直接使用位图池会导致未定义的行为。