Android的位图回收的问题,我需要保持位图的所有引用,调用recycle方法? [英] Android Bitmap recycle question, do I need to maintain all the references of Bitmap, to call recycle method?

查看:101
本文介绍了Android的位图回收的问题,我需要保持位图的所有引用,调用recycle方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们经常得到的图像从服务器作为字节流,那么我们创建位图,并将其分配给ImageView的对象。

Frequently we get image from server as byte stream, then we create Bitmap and assign it to ImageView object.

当我需要释放的内存,我可以下降到空所有ImageView的引用,让GC做的工作。

When I need to release memory, I can drop all ImageView references to null, letting the gc do the work.

但问题是,这样一来,我没有叫位图的循环方法,因为我没有保持它的引用。所以,我想知道的是,我需要保持位图的所有引用,在未来回收呢?

But question is, in this way, I did not call the recycle method of Bitmap since I did not keep references of it. So I wonder that, do I need to maintain all the references of Bitmap, to recycle them in the future?

推荐答案

没有你不需要,GC将做给你。

No you don't need to, the GC will do it for you.

这篇关于Android的位图回收的问题,我需要保持位图的所有引用,调用recycle方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆