Hey blind, you're right, I'm using Drawables -- BitmapDrawables, to be precise. This is for an ImageSwitcher, so I need a Drawable of some sort (since I'm loading jpeg images off the storage device, so I can't use resources). I've tried BitmapFactory.decodeFile() instead of BitmapDrawables constructor that takes a String, but I get the same result, except that the OutOfMemoryException is now in BitmapFactory.decodeFile() itself instead of a cryptic callstack like before.
I also call the gc right before creating the Bitmap... and the TTY is kind of interesting: 06:50:43.970: INFO/dalvikvm-heap(6039): Clamp target GC heap from 17.019MB to 16.000MB 06:50:43.990: DEBUG/dalvikvm(6039): GC freed 8139 objects / 927224 bytes in 171ms 06:50:45.271: ERROR/dalvikvm-heap(6039): 38400-byte external allocation too large for this process. 06:50:45.271: ERROR/(6039): VM won't let us allocate 38400 bytes 06:50:45.280: DEBUG/skia(6039): xxxxxxxxxxxxxxxxxxxx allocPixelRef failed The gc freed 927KB, and then cannot allocate 38KB? Um, what? -Mike On Nov 13, 2:11 am, blindfold <[EMAIL PROTECTED]> wrote: > Do you use Drawable's by any chance? See > alsohttp://groups.google.com/group/android-developers/browse_thread/threa... > I had plenty of memory allocation problems on the G1 until I started > using BitmapFactory.decodeResource(getResources() instead of > getResources().getDrawable(). Also, try to avoid static loading of > images that you can also load dynamically, one by one, when needed > while releasing the ones that you do not need at any given moment. > Finally, calling System.gc() when loading a new image does no harm and > might help the garbage collector to stay further away from the heap > limits. > > On Nov 13, 6:10 am, EboMike <[EMAIL PROTECTED]> wrote: > > > I'm getting this error too pretty often (mostly after changing > > orientation a few times). I just have a Gallery with up to three > > images visible at the same time, and one ImageSwitcher with images > > that are typically 1024x768 in size or less. I'm using the Heap view > > in Eclipse, and there's tons of memory available (not sure if > > fragmentation is an issue, the Heap view doesn't have any information > > on that). > > > That surely can't be touching the limits of the VM - how am I supposed > > to get this working? I could be more aggressive in disposing objects, > > but since I don't have any lingering references to anything, and the > > gc kicks in whenever memory is low (as LogCat clearly indicates), I > > don't see why this should be necessary. > > > My LogCat says: > > > 11-13 05:02:21.602: DEBUG/dalvikvm(31410): GC freed 1351 objects / > > 597328 bytes in 69ms > > 11-13 05:02:24.200: DEBUG/dalvikvm(47): GC freed 4402 objects / 275688 > > bytes in 116ms > > 11-13 05:02:27.691: DEBUG/dalvikvm(31410): GC freed 860 objects / > > 347368 bytes in 61ms > > 11-13 05:02:31.151: DEBUG/dalvikvm(31410): GC freed 591 objects / > > 196624 bytes in 76ms > > 11-13 05:02:32.781: ERROR/dalvikvm-heap(31410): 1134000-byte external > > allocation too large for this process. > > 11-13 05:02:32.781: ERROR/(31410): VM won't let us allocate 1134000 > > bytes > > 11-13 05:02:32.781: DEBUG/skia(31410): xxxxxxxxxxxxxxxxxxxx > > allocPixelRef failed --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

