Wednesday, April 11, 2012

[android-developers] Re: Anyway to pre allocate memory for a Bitmap?

I did eventually figure out how to pre-allocate a Bitmap.  After looking at the documentation more closely.

I realize you can create a ByteArray, and the BitmapFactory has option for using a ByteArray to store the bitmap, instead of allocating its own memory.

You can then reuse ByteArray for several bitmaps, assuming your finished with one bitmap before you use it for the next bitmap.

On Monday, September 27, 2010 3:56:00 PM UTC-4, Brian wrote:
Hello is there any way to pre allocate the memory required for a
bitmap.  Android's memory model is making it very difficult for me to
cache images I need to cache.

It would seem the problem is because the VM heap rarely shrinks
itself, so I would like to just allocate memory for bitmaps ahead of
time? but I can not figure out how to do this?

Any help please!

--
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

No comments:

Post a Comment