08-15 21:03:17.995: INFO/ActivityManager(87): Config changed: { scale=1.0 imsi=460/2 loc=en_HK touch=3 keys=1/1/2 nav=3/1 orien=1 layout=17}
08-15 21:03:18.285: ERROR/dalvikvm-heap(4044): 1800-byte external allocation too large for this process.
08-15 21:03:18.295: ERROR/dalvikvm(4044): Out of memory: Heap Size=12167KB, Allocated=9623KB, Bitmap Size=4242KB
08-15 21:03:18.295: ERROR/(4044): VM won't let us allocate 1800 bytes
08-15 21:03:18.305: DEBUG/skia(4044): --- decoder->decode returned false
08-15 21:03:18.325: DEBUG/AndroidRuntime(4044): Shutting down VM
08-15 21:03:18.325: WARN/dalvikvm(4044): threadid=3: thread exiting with uncaught exception (group=0x4001e390)
08-15 21:03:18.325: ERROR/AndroidRuntime(4044): Uncaught handler: thread main exiting due to uncaught exception
08-15 21:03:18.395: ERROR/AndroidRuntime(4044): android.view.InflateException: Binary XML file line #18: Error inflating class <unknown>
08-15 21:03:18.395: ERROR/AndroidRuntime(4044): at android.view.LayoutInflater.createView(LayoutInflater.java:513)
08-15 21:03:18.395: ERROR/AndroidRuntime(4044): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
08-15 21:03:18.395: ERROR/AndroidRuntime(4044): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
08-15 21:03:18.395: ERROR/AndroidRuntime(4044): at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
08-15 21:03:18.395: ERROR/AndroidRuntime(4044): at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
08-15 21:03:18.395: ERROR/AndroidRuntime(4044): at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
08-15 21:03:18.395: ERROR/AndroidRuntime(4044): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
08-15 21:03:18.395: ERROR/AndroidRuntime(4044): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
08-15 21:03:18.395: ERROR/AndroidRuntime(4044): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:207)
08-15 21:03:18.395: ERROR/AndroidRuntime(4044): at android.app.Activity.setContentView(Activity.java:1629)
08-15 21:03:18.395: ERROR/AndroidRuntime(4044): at com.acemetrix.droidapp.activity.BaseActivity.setContentView(BaseActivity.java:345)
08-15 21:03:18.395: ERROR/AndroidRuntime(4044): at com.acemetrix.droidapp.activity.AdDetailViewActivity.displayPortraitLayoutView(AdDetailViewActivity.java:184)
08-15 21:03:18.395: ERROR/AndroidRuntime(4044): at com.acemetrix.droidapp.activity.AdDetailViewActivity.onConfigurationChanged(AdDetailViewActivity.java:263)
08-15 21:03:18.395: ERROR/AndroidRuntime(4044): at android.app.ActivityThread.performConfigurationChanged(ActivityThread.java:3929)
08-15 21:03:18.395: ERROR/AndroidRuntime(4044): at android.app.ActivityThread.handleConfigurationChanged(ActivityThread.java:3998)
08-15 21:03:18.395: ERROR/AndroidRuntime(4044): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2005)
08-15 21:03:18.395: ERROR/AndroidRuntime(4044): at android.os.Handler.dispatchMessage(Handler.java:99)
08-15 21:03:18.395: ERROR/AndroidRuntime(4044): at android.os.Looper.loop(Looper.java:123)
08-15 21:03:18.395: ERROR/AndroidRuntime(4044): at android.app.ActivityThread.main(ActivityThread.java:4603)
08-15 21:03:18.395: ERROR/AndroidRuntime(4044): at java.lang.reflect.Method.invokeNative(Native Method)
08-15 21:03:18.395: ERROR/AndroidRuntime(4044): at java.lang.reflect.Method.invoke(Method.java:521)
08-15 21:03:18.395: ERROR/AndroidRuntime(4044): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
08-15 21:03:18.395: ERROR/AndroidRuntime(4044): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
08-15 21:03:18.395: ERROR/AndroidRuntime(4044): at dalvik.system.NativeStart.main(Native Method)
08-15 21:03:18.395: ERROR/AndroidRuntime(4044): Caused by: java.lang.reflect.InvocationTargetException
08-15 21:03:18.395: ERROR/AndroidRuntime(4044): at android.widget.Button.<init>(Button.java:65)
08-15 21:03:18.395: ERROR/AndroidRuntime(4044): at java.lang.reflect.Constructor.constructNative(Native Method)
08-15 21:03:18.395: ERROR/AndroidRuntime(4044): at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
08-15 21:03:18.395: ERROR/AndroidRuntime(4044): at android.view.LayoutInflater.createView(LayoutInflater.java:500)
08-15 21:03:18.395: ERROR/AndroidRuntime(4044): ... 23 more
08-15 21:03:18.395: ERROR/AndroidRuntime(4044): Caused by: java.lang.OutOfMemoryError: bitmap size exceeds VM budget
08-15 21:03:18.395: ERROR/AndroidRuntime(4044): at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
08-15 21:03:18.395: ERROR/AndroidRuntime(4044): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:464)
08-15 21:03:18.395: ERROR/AndroidRuntime(4044): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:340)
08-15 21:03:18.395: ERROR/AndroidRuntime(4044): at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:697)
08-15 21:03:18.395: ERROR/AndroidRuntime(4044): at android.content.res.Resources.loadDrawable(Resources.java:1705)
08-15 21:03:18.395: ERROR/AndroidRuntime(4044): at android.content.res.Resources.getDrawable(Resources.java:580)
08-15 21:03:18.395: ERROR/AndroidRuntime(4044): at android.graphics.drawable.StateListDrawable.inflate(StateListDrawable.java:160)
08-15 21:03:18.395: ERROR/AndroidRuntime(4044): at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:788)
08-15 21:03:18.395: ERROR/AndroidRuntime(4044): at android.graphics.drawable.Drawable.createFromXml(Drawable.java:729)
08-15 21:03:18.395: ERROR/AndroidRuntime(4044): at android.content.res.Resources.loadDrawable(Resources.java:1690)
08-15 21:03:18.395: ERROR/AndroidRuntime(4044): at android.content.res.TypedArray.getDrawable(TypedArray.java:548)
08-15 21:03:18.395: ERROR/AndroidRuntime(4044): at android.view.View.<init>(View.java:1850)
08-15 21:03:18.395: ERROR/AndroidRuntime(4044): at android.widget.TextView.<init>(TextView.java:335)
08-15 21:03:18.395: ERROR/AndroidRuntime(4044): at android.widget.Button.<init>(Button.java:69)
08-15 21:03:18.395: ERROR/AndroidRuntime(4044): ... 27 more
08-15 21:03:18.435: INFO/Process(87): Sending signal. PID: 4044 SIG: 3
---------------这个问题应该被解决(20110823):
今天又发现,当在AD Detail View横竖屏切换的时候,切换次数多了,Runtime.getRuntime().totalMemory()数值就会越来越大,当大于11M的时候,很容易出现OOM的情况。
找到一个方法:
在create的时候把横屏和坚屏的布局都加载进来并用两个view分别存起来 ,切屏时setContentView(前面保存的view),而不是每次切屏时让程序加载XML文件中的布局
这个方法是有效果的,可是还是不能避免,Runtime.getRuntime().totalMemory()还是会慢慢增加,不过确实是有一些效果的。
再找找吧。。。。