Ok, as told on previous emails, I managed to reduce the heap use even more sacrificing image definition on xdpi devices. The good news is that most of the OOM crashes seems to gone, but the bad news is that NOT all of them and the worst is that this kind of crashes in particular persists.

java.lang.OutOfMemoryError: (Heap Size=49187KB, Allocated=38975KB)

Again, there is more heap available than the one needed by the image trying to load. But anyway there is a worse problem here: it shouldn't beign using 38Mb in no way neither...

Anyway I have had only two of these in last 24 hours, both in devices with Android 4.0.4, both with rare resolutions with a density between hdpi and xdpi, and in both cases it happened after ten minutes of game play, so it may be a memory leak. The problem, again, is that it only seems to affect a few devices that I haven't to test, and I have not seen memory leaks in no other, so I think that if the incidence of this problem were just about two crashes on a thousand boots, I would just ignore it.

Best regards,


On 11/21/2012 03:58 PM, Mark Murphy wrote:
First, you do not know necessarily what BitmapFactory.Options are being specified on the decodeResource() call, as that does not appear to be called from your code, and it could be they have strange values in there.

Beyond that, last I knew, Dalvik does not have a compacting garbage collector. I haven't seen a recent statement as to whether or not that limitation has been fixed. If it is still the case, though, your issue may not so much that you are out of memory, but that there is no single contiguous block that meets your needs.

On Wed, Nov 21, 2012 at 9:48 AM, Francisco Marzoa <[email protected] <mailto:[email protected]>> wrote:

    Look at this:

    0java.lang.OutOfMemoryError: (Heap Size=48547KB, Allocated=33541KB)
    1at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
    2at
    android.graphics.BitmapFactory.decodeResource(BitmapFactory.java:595)
    3at
    
com.badlogic.androidgames.framework.impl.AndroidGraphics.newPixmap(AndroidGraphics.java:77)

    4at
    
com.badlogic.androidgames.framework.impl.AndroidGraphics.newPixmap(AndroidGraphics.java:133)

    5at
    
net.iberdroid.ruletaafortunadacore.MainMenuScreen.loadImages(MainMenuScreen.java:255)

    6at
    
net.iberdroid.ruletaafortunadacore.MainMenuScreen.enable(MainMenuScreen.java:241)



    The image that I am trying to load at MainMenuScreen.java:255

    The weird thing is that there is free heap enough for loading that
    image: it is a 800x480 png indexed but with transparency, so I
    load it using four bytes per pixel (ARGB) and it should use about
    1M5 of memory as a raw bitmap... but it crashes anyway trying to
    load an image ten times smaller the available heap space (48-35 =
    15Mb).

    These things makes me crazy...

    Bests,



-- You received this message because you are subscribed to the Google
    Groups "Android Developers" group.
    To post to this group, send email to
    [email protected]
    <mailto:[email protected]>
    To unsubscribe from this group, send email to
    [email protected]
    <mailto:android-developers%[email protected]>
    For more options, visit this group at
    http://groups.google.com/group/android-developers?hl=en




--
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

_The Busy Coder's Guide to Android Development_ Version 4.3 Available!
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to