Note that there are some explanatory texts on larger screens.

plurals
  1. PODDMS allocation tracker filled with "SimpleListIterator"
    primarykey
    data
    text
    <p>I'm trying to crack down on a memory leak which is causing the heap to run out of memory and the GC to get invoked. A lot.</p> <p>Logcat is filled with messages like this:</p> <blockquote> <p>11-27 20:54:39.052: DEBUG/dalvikvm(32167): GC_CONCURRENT freed 405K, 5% free 11046K/11591K, paused 2ms+3ms</p> </blockquote> <p>I used the DDMS Allocation tracker to see if there was anything in particular getting allocated more than usual, and the instant that I clicked the 'Get Allocations' button in Eclipse, the list was filled with <em>java.util.AbstractList$SimpleListIterator</em> They get allocated during the main game loop, so there are lots, and I believe this is what is eating the heap memory.(there are approx. 509 allocations of SimpleListIterator)</p> <p>However, DDMS is telling me that they are being allocated wherever there is a for-each loop, which I think is strange. o_O</p> <p>Normally I would use a regular for loop, but <a href="http://developer.android.com/guide/practices/design/performance.html#foreach" rel="nofollow">this article</a> recommends using the for-each loop instead since it's faster, but it mentions nothing about its memory usage</p> <p>Could all these allocations be the result of using the for-each loop instead of the regular for loop? (It'll take a while to go in and change every single for-each loop in my app, so I'd rather ask first) If they are, then is this normal? Is it a programming error on my part?</p> <p><strong>UPDATE</strong> I changed the for-each loops to regular for loops and the completely solved the problem. I still think its dumb though that I had to do that</p>
    singulars
    1. This table or related slice is empty.
    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.
 

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