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

Reply via email to