> Apparently there is a problem in UI Framework with drawable resources > management. If an activity uses a layout with an image file statically > linked > as background (and possibly some other attributes), every time the > activity is > created, a new bitmap object is generated and never gets released, > which > eventually leads to out of memory exception.
No, this is not true. He is confused about a blog post I wrote explaining that keeping Drawable instances in static fields of classes can cause memory leaks. But his analysis is just plain wrong. > So we either need to fix it on the framework side, so that when an > activity is > destroyed, all drawable objects associated with it are released as > well, or we > need to make sure that all static images are handled by all the > applications in > a proper way and all drawables are recycled explicitly. They are released. The problem is that on rotation, the old activity and the new activity can shortly live in memory at the same time. In your case you are using an 8 MB image (when loaded in ARGB 8888.) Do the math: 8 * 2 MB = 16 MB, therefore you are blowing up the Java heap. -- Romain Guy Android framework engineer [email protected] Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

