title: Android: Out of memory on a byte allocation (android.graphics.Bitmap)
body: <p>I Brought my app back into view after a while of it sitting idle in the background and I noticed it being very slow and then just not responsive. So then I checked logcat and I see<br>
  "Out of memory on a 557296-byte allocation".  The last thing I did before my app going idle was add several records to a couple tables in my database.  However, the last line in my logcat before the memory error has something to do with a bitmap?..."android.graphics.Bitmap.createBitmap" . I'm not sure how to begin tracking this down.</p>
  
  <pre><code>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
  </code></pre>