Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>First, I think the Dalvik message is showing the wrong units whereas the GraphicsJNI error is correct:</p> <blockquote> <p>dalvikvm E Out of memory: Heap Size=4871KB, Allocated=2636KB, Bitmap Size=19528KB 2935<br> GraphicsJNI E VM won't let us allocate 195364 bytes</p> </blockquote> <p>Keep in mind you can catch the memory error:</p> <pre><code>try{ mBackground = Bitmap.createBitmap(getWidth(), getHeight(), Bitmap.Config.ARGB_8888); } catch(OutOfMemoryError e){ //do something } </code></pre> <p>If your bitmaps are always the same size, I would recommend re-using them. If you are creating and destroying bitmaps fairly quickly, you run the risk of out-pacing the Garbage Collector and getting into this state.</p> <p>--Edit-- As for your original question. I typically do the following when looking for a memory leak.</p> <p><strong>Initialization Steps</strong></p> <ol> <li>Make sure your app is set to be debuggable in the manifest</li> <li>Launch your app, open DDMS and select your application.</li> <li>Select the Allocation Tracker view and Start Tracking</li> </ol> <p><strong>Analysis</strong></p> <ol> <li>Let your app run, or perform some specific activities in your app that are causing memory issues.</li> <li>Click "Get Allocations" to update the tracker. You can now stop tracking if you like.</li> <li>In the filter, type your application name to narrow down the results.</li> </ol> <p>You need to think about what you are seeing here and whether it makes sense for your application. Should there be 1000's of small memory allocations? Most likely not. At this point you can click on an allocation and see exactly which method and line number is causing the allocation.</p> <p>Another route to take is to enable heap updates for your app and use the heap explorer to track allocations. The heap explorer does not tell you <em>where</em> the allocation is coming from, but what it will tell you is that for instance:</p> <blockquote> <p>The number of 1k allocations is growing and never shrinking.</p> </blockquote> <p>You can then go into the Allocation Tracker and sort allocations by size to see where you are performing 1k allocations.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload