Android 中的位图 [英] Bitmaps in Android

查看:23
本文介绍了Android 中的位图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有几个关于位图对象和内存及其一般分类的问题.

I have a few questions regarding Bitmap objects and memory and their general taxonomy.

  1. 什么是内存位图或本机位图?
  2. 位图内存与堆内存有何不同?

推荐答案

支持 Bitmap 对象的内存是使用本机代码 (malloc()) 分配的,而不是 Java new 关键字.这意味着内存由操作系统直接管理,而不是由 Dalvik 管理.

The memory that backs a Bitmap object is allocated using native code (malloc()), rather than the Java new keyword. This means that the memory is managed directly by the OS, rather than by Dalvik.

本机堆和 Dalvik 的堆之间唯一真正的区别是 Dalvik 的堆是垃圾收集的,而本机的不是.

The only real difference between the native heap and Dalvik's heap is that Dalvik's heap is garbage collected, and the native one isn't.

不过,出于这些目的,这里没有太大区别.当您的 Bitmap 对象被垃圾回收时,它的析构函数将回收本机堆中的相关内存.

For these purposes though, here's not much difference. When your Bitmap object gets garbage collected, it's destructor will recycle the associated memory in the native heap.

来源:

这篇关于Android 中的位图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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