[android-developers] Re: OutOfMemory exception in OnCreate
You might want to try just tossing a System.gc() in early on in your
onCreate. That almost always solves out of memory problems for me on
Android. It's a shame the memory management is so badly written that
it needs this. You aren't supposed to be able to get an out of memory
error when garbage collection would help. That's how it works out,
unfortunately, however. Has something to do with memory taken up by
bitmaps not getting collected until finalizers run, or being tracked
separately or something like that. There's countless threads on this
if you search. I see it happen even when I'm not using bitmaps
manually and when I am, but I'm calling recycle on them properly, so
they probably get used by built-in stuff as well.
On Oct 2, 7:53 pm, Yahel <kaye...@gmail.com> wrote:
> Thank you for your answer.
>
> > You haven't shown us enough of your code (code snippets) for us to...
>
> Yes sorry about that, it's just that I don't seem to understand where
> everything goes wrong. The line giving me an error is a simple
> setContentView with a simple background image in a FrameView. So I am
> trying to narrow down the causes before I overflow the group with my
> 10 000 or so lines of code :D
>
> > But since many instances of your activity can exists,
>
> Do you mean that there can be multiple instances of my app running at
> the same time, all using the same oncreate method ? I didn't know it
> was possible...Could you explain to me how to reproduce this case ?
>
> Tahnks again for your time.
>
> Yahel
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home