So I am allocating a 4659200 bytes int[] that should be used as pixels in a bitmap (a background bitmap). The int[] should be collected since it's local to a method but somehow I get this stack trace:
D/dalvikvm( 339): GC_EXTERNAL_ALLOC freed 18K, 76% free 2882K/11783K, external 7405K/7713K, paused 91ms I/System.out( 339): background width: 320 height: 3640 total size: 4659200 bytes D/dalvikvm( 339): threadid=11: still suspended after undo (sc=1 dc=1) D/dalvikvm( 339): threadid=14: still suspended after undo (sc=1 dc=1) D/dalvikvm( 339): GC_FOR_MALLOC freed 3K, 76% free 2882K/11783K, external 11955K/14003K, paused 61ms I/dalvikvm-heap( 339): Forcing collection of SoftReferences for 4659216-byte allocation D/dalvikvm( 339): threadid=14: still suspended after undo (sc=1 dc=1) D/dalvikvm( 339): threadid=11: still suspended after undo (sc=1 dc=1) D/dalvikvm( 339): GC_FOR_MALLOC freed <1K, 76% free 2881K/11783K, external 11955K/14003K, paused 56ms E/dalvikvm-heap( 339): Out of memory on a 4659216-byte allocation. I am not getting it. It says 76% free but that seems to be some internal stuff since the external does increase from 7405 to 11955 which is correct since the object is 4 MB but why does it go to the "external" memory? And finally this is the line that causes the OutOfMemory: int[] pixel = new int[backgroundBitmap.getWidth() * backgroundBitmap.getHeight()]; //width: 320 height: 3640 -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en