Was it actually your app that was getting the error? The Launcher suffered from this problem in 2.1 on a Nexus One if you had a lot of applications; it seems fixed in 2.1 Update 1.
If it's your app, you can investigate this from the DDMS perspective. Select your app, hit the "Update Heap" button at the top, and then the "Cause GC" button, and you'll see usage by type of object on the right in the Heap window. Select a type, and you'll see a histogram of object sizes / counts. If you add the Memory Analyzer features (there are two, add them both; one provides the basics, and the other adds charts), to your Eclipse environment from the Ganymede update site, you can see a great deal more detail. Just click th Download HPROF File button. I won't even try to describe all the nice bits of analysis it can do. You may find you need to temporarily give your app WRITE_TO_EXTERNAL_STORAGE permission so that the .hprof file can be written to the sdcard. Once you've done this, you probably don't need it again, though I did have to re-add it for one session after I downloaded the Memory Analyzer. On Feb 21, 12:14 pm, Lance Nanek <[email protected]> wrote: > You might want to try calling System.gc() manually somewhere in there, > like in onCreate. It has worked for me in the past to avoid that > exception when recreating heavy weight activities. > > It's kind of an ugly hack, though. The call is documented as not even > guaranteed to do anything. Also, you aren't supposed to be able to run > out of memory if there is garbage to be collected that would prevent > it. > > A wild off the wall guess as to why it works in some cases could be > that the manual GC call triggers some finalizers which free up some > memory not directly under the garbage collector's control, resulting > in more free memory than the system thought it could get from garbage > collecting. Or it could just be a bug, like you said. > > Last time I asked someone about the issue, they said to make sure I > was calling recycle on all my Bitmap instances when I was done with > them and things like that. I already was in my case, and it sounds > like you've eliminated that in your test, but that's another thing to > check in similar situations. > > On Feb 21, 2:04 pm, Moto <[email protected]> wrote: > > > > > I got this issue that after changing orientation about 7 times I get > > the OutOfMemoryError. :( > > > What's wrong!? I stripped my app to the point were it only does > > setContentView(...) and still I can reproduce the issue. > > > I do use all custom graphics. Now this tells me there is a leak and a > > big one somewhere, but it seems not in my code! Where than!? a bug on > > the OS? Can a xml layout have leaks? > > > Please any help finding the issue would help! > > > Thanks, > > -Moto! -- 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

