在后台闲置一段时间后,我将我的应用程序重新显示出来,我注意到它非常慢,然后就是没有响应。然后我检查了 logcat,我看到
“在 557296 字节分配上内存不足”。在我的应用程序闲置之前我做的最后一件事是在我的数据库中的几个表中添加几条记录。但是,内存错误之前我的 logcat 中的最后一行与位图有关?..."android.graphics.Bitmap.createBitmap" 。我不知道如何开始追踪这个。
11-07 20:32:22.940: D/PMS(599): acquireWL(42e31570): PARTIAL_WAKE_LOCK CM_static 0x1 13857 10166
11-07 20:32:22.950: D/PMS(599): releaseWL(42e31570): PARTIAL_WAKE_LOCK CM_static 0x1
11-07 20:32:23.060: E/dalvikvm(16038): can't open /data/misc/app_oom.hprof: Permission denied
11-07 20:32:23.100: E/dalvikvm-heap(16038): hprofDumpHeap failed with result: -1
11-07 20:32:23.100: E/dalvikvm-heap(16038): After hprofDumpHeap for process
11-07 20:32:23.100: E/dalvikvm(16038): Out of memory: Heap Size=196608KB, Allocated=188196KB, Limit=196608KB, Proc Limit=196608KB
11-07 20:32:23.100: E/dalvikvm(16038): Extra info: Footprint=196512KB, Allowed Footprint=196608KB, Trimmed=2828KB
11-07 20:32:23.200: I/dalvikvm-heap(16038): Clamp target GC heap from 193.013MB to 192.000MB
11-07 20:32:23.200: I/dalvikvm-heap(16038): Forcing collection of SoftReferences for 557296-byte allocation
11-07 20:32:23.240: D/MtpDatabase(25526): sessionStarted
11-07 20:32:23.310: I/dalvikvm-heap(16038): Clamp target GC heap from 193.013MB to 192.000MB
11-07 20:32:23.310: E/dalvikvm-heap(16038): Out of memory on a 557296-byte allocation.
11-07 20:32:23.310: I/dalvikvm(16038): "main" prio=5 tid=1 RUNNABLE
11-07 20:32:23.310: I/dalvikvm(16038): | group="main" sCount=0 dsCount=0 obj=0x41f267e8 self=0x41f113b8
11-07 20:32:23.310: I/dalvikvm(16038): | sysTid=16038 nice=0 sched=0/0 cgrp=apps handle=1074839548
11-07 20:32:23.310: I/dalvikvm(16038): | state=R schedstat=( 0 0 0 ) utm=61459 stm=7538 core=3
11-07 20:32:23.310: I/dalvikvm(16038): at android.graphics.Bitmap.nativeCreate(Native Method)
11-07 20:32:23.310: I/dalvikvm(16038): at android.graphics.Bitmap.createBitmap(Bitmap.java:1041)
11-07 20:32:23.310: I/dalvikvm(16038): at android.graphics.Bitmap.createBitmap(Bitmap.java:983)
11-07 20:32:23.310: I/dalvikvm(16038): at android.view.View.buildDrawingCache(View.java:13312)
11-07 20:32:23.310: I/dalvikvm(16038): at android.view.View.getDrawingCache(View.java:13161)
11-07 20:32:23.310: I/dalvikvm(16038): at android.view.View.draw(View.java:13859)
11-07 20:32:23.310: I/dalvikvm(16038): at android.view.ViewGroup.drawChild(ViewGroup.java:3105)
11-07 20:32:23.310: I/dalvikvm(16038): at android.widget.ListView.drawChild(ListView.java:3590)
11-07 20:32:23.310: I/dalvikvm(16038): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2934)
11-07 20:32:23.310: I/dalvikvm(16038): at android.widget.AbsListView.dispatchDraw(AbsListView.java:2520)
11-07 20:32:23.310: I/dalvikvm(16038): at android.widget.ListView.dispatchDraw(ListView.java:3560)
11-07 20:32:23.310: I/dalvikvm(16038): at android.view.View.draw(View.java:14175)
11-07 20:32:23.310: I/dalvikvm(16038): at android.widget.AbsListView.draw(AbsListView.java:3993)
11-07 20:32:23.310: I/dalvikvm(16038): at android.view.View.draw(View.java:14053)
11-07 20:32:23.310: I/dalvikvm(16038): at android.view.ViewGroup.drawChild(ViewGroup.java:3105)
11-07 20:32:23.310: I/dalvikvm(16038): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2934)
11-07 20:32:23.310: I/dalvikvm(16038): at android.view.View.draw(View.java:14175)
11-07 20:32:23.310: I/dalvikvm(16038): at android.view.View.draw(View.java:14053)
11-07 20:32:23.310: I/dalvikvm(16038): at android.view.ViewGroup.drawChild(ViewGroup.java:3105)
11-07 20:32:23.310: I/dalvikvm(16038): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2934)
11-07 20:32:23.310: I/dalvikvm(16038): at android.view.View.draw(View.java:14051)
11-07 20:32:23.310: I/dalvikvm(16038): at android.view.ViewGroup.drawChild(ViewGroup.java:3105)
11-07 20:32:23.310: I/dalvikvm(16038): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2934)
11-07 20:32:23.310: I/dalvikvm(16038): at android.view.View.draw(View.java:14051)
11-07 20:32:23.310: I/dalvikvm(16038): at android.view.ViewGroup.drawChild(ViewGroup.java:3105)
11-07 20:32:23.310: I/dalvikvm(16038): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2934)
11-07 20:32:23.310: I/dalvikvm(16038): at android.view.View.draw(View.java:14175)
11-07 20:32:23.310: I/dalvikvm(16038): at android.widget.FrameLayout.draw(FrameLayout.java:467)
11-07 20:32:23.310: I/dalvikvm(16038): at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:2312)
11-07 20:32:23.310: I/dalvikvm(16038): at android.view.ViewRootImpl.drawSoftware(ViewRootImpl.java:2761)
11-07 20:32:23.310: I/dalvikvm(16038): at android.view.ViewRootImpl.draw(ViewRootImpl.java:2674)
11-07 20:32:23.310: I/dalvikvm(16038): at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2491)
11-07 20:32:23.310: I/dalvikvm(16038): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2048)
11-07 20:32:23.310: I/dalvikvm(16038): at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1119)
11-07 20:32:23.310: I/dalvikvm(16038): at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5849)
11-07 20:32:23.310: I/dalvikvm(16038): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:786)
11-07 20:32:23.310: I/dalvikvm(16038): at android.view.Choreographer.doCallbacks(Choreographer.java:586)
11-07 20:32:23.310: I/dalvikvm(16038): at android.view.Choreographer.doFrame(Choreographer.java:546)
11-07 20:32:23.310: I/dalvikvm(16038): at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:771)
11-07 20:32:23.310: I/dalvikvm(16038): at android.os.Handler.handleCallback(Handler.java:730)
11-07 20:32:23.310: I/dalvikvm(16038): at android.os.Handler.dispatchMessage(Handler.java:92)
11-07 20:32:23.310: I/dalvikvm(16038): at android.os.Looper.loop(Looper.java:158)
11-07 20:32:23.310: I/dalvikvm(16038): at android.app.ActivityThread.main(ActivityThread.java:5789)
11-07 20:32:23.310: I/dalvikvm(16038): at java.lang.reflect.Method.invokeNative(Native Method)
11-07 20:32:23.310: I/dalvikvm(16038): at java.lang.reflect.Method.invoke(Method.java:525)
11-07 20:32:23.310: I/dalvikvm(16038): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1027)
11-07 20:32:23.310: I/dalvikvm(16038): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:843)
11-07 20:32:23.310: I/dalvikvm(16038): at dalvik.system.NativeStart.main(Native Method)
11-07 20:32:23.310: E/dalvikvm-heap(16038): Generating hprof for process: com.test.myApp PID: 16038