Android 造成堆大小和分配内存之间差异的因素是什么?
我跟踪了堆大小,并在不同的设备上分配了内存。我想知道为什么这些价值观之间存在差异,你是如何处理的?谢谢你的帮助 my layout.xmlAndroid 造成堆大小和分配内存之间差异的因素是什么?,android,memory-management,heap,Android,Memory Management,Heap,我跟踪了堆大小,并在不同的设备上分配了内存。我想知道为什么这些价值观之间存在差异,你是如何处理的?谢谢你的帮助 my layout.xml <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerInParent="true" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:src="@drawable/square1" />
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="@string/hello_world"
android:textSize="@dimen/txt_size" />
</FrameLayout>
</RelativeLayout>
装置
i9100
p6700
n7000
dalvik vm堆大小在每个android版本/设备的/system/build.prop首选项文件中设置。确切的首选项是dalvik.vm.heapsize。该值以兆字节为单位,取决于设备功能 如何处理不同的价值观?以下是一些一般性提示
- 始终使您的应用程序在您计划支持的最低规格设备上可用
- 为每种类型的设备提供所有类型的资源,特别是图像和视频
- 对引用要格外小心,因为它们可能会阻止垃圾收集器收回内存(又称内存泄漏)