Thanks Lance! Your tip about System.gc() doesn't seem to make a difference. :(
Just so anyone that has this issue: I started with a stripped activity no allocations just loading my template seemed to resolve issues. From there I slowly started adding things and optimizing couple things that seem to leak. In any case using a G1 and opening and closing the keyboard fast does lead to the memory exception. So it seems that it does not clear memory fast enough. Now you might think who is going to open and close the keyboard that fast? Well it just helps put the phone in extremes situations where the CPU is slow and it can't free memory fast enough... It really sucks that this happens and I got many users complaining about this issue... :( Any other ideas tips, possibly catching this exception giving the CPU some time to clear memory and than start the activity? That would be perfect! Thanks, Moto! On Feb 21, 3: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

