我已经跟踪了不同设备上的堆大小和分配内存。我想知道为什么这些值(value)观之间存在差异,您的处理方法是什么?感谢您的帮助。
我的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: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 虚拟机堆大小在每个 android 版本/设备的/system/build.prop 首选项文件中设置。确切的首选项键是 dalvik.vm.heapsize。该值以兆字节为单位,取决于设备能力
如何处理不同的值?这里有一些一般提示
- 始终让您的应用可在您计划支持的最低规范设备上使用
- 为每种类型的设备提供所有类型的资源,特别是图像和视频。
- 对引用要格外小心,因为它们可能会阻止垃圾收集器回收内存(也就是内存泄漏)
关于android - 导致堆大小和分配的内存之间存在这些差异的因素是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13444511/