在Android的位图位图、Android

2023-09-11 20:06:58 作者:浮若安生

我有一个关于位图对象和内存及通用分类标准的几个问题。

什么是内存或本机位图? 如何为位图从内存堆内存不同? 解决方案

这是备份一个位图对象,使用分配的内存本土code(的malloc()) ,而不是Java的关键字。这意味着,存储器直接管理由OS,而不是通过的Dalvik

本机堆和的Dalvik的堆之间真正的区别是,Dalvik的堆中被垃圾回收,和本机一个没有了。

为了这些目的虽然,这里是没有太大的区别。当你的位图对象被垃圾回收,它的析构函数会回收相关的内存,本机堆。

来源:

http://osdir.com/ml/AndroidDevelopers/2009-03/msg00023.html android:platform/frameworks/base/graphics/java/android/graphics/Bitmap.java android:platform/frameworks/base/core/jni/android/graphics/Bitmap.cpp

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

What is an in-memory or native bitmap? How is Bitmap memory different from Heap memory? 最新版本分布图 39.2 的用户仍在用Android 4.4

解决方案

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.

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.

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.

Source:

http://osdir.com/ml/AndroidDevelopers/2009-03/msg00023.html android:platform/frameworks/base/graphics/java/android/graphics/Bitmap.java android:platform/frameworks/base/core/jni/android/graphics/Bitmap.cpp