2015년 4월 30일 목요일

android:largeHeap

<application android:icon="@drawable/icon"
android:label="@string/app_name"
        android:theme="@style/AppTheme"
        android:largeHeap="true"



여려가지 이유에서 android bitmap 처리를 하다보면, 대책없이 dalvic 에서 out of memory 가 나서 app 이 crash 되는 경우가 있다. AndroidManifest.xml 추가

android:largeHeap
Whether your application's processes should be created with a large Dalvik heap. This applies to all processes created for the application. It only applies to the first application loaded into a process; if you're using a shared user ID to allow multiple applications to use a process, they all must use this option consistently or they will have unpredictable results.
Most apps should not need this and should instead focus on reducing their overall memory usage for improved performance. Enabling this also does not guarantee a fixed increase in available memory, because some devices are constrained by their total available memory.
To query the available memory size at runtime, use the methods getMemoryClass() orgetLargeMemoryClass().

ref : http://developer.android.com/guide/topics/manifest/application-element.html


<application android:icon="@drawable/icon"
android:label="@string/app_name" 
        android:theme="@style/AppTheme" 
        android:largeHeap="true">

댓글 없음: