I didn't see an answer to your question. You should always recycle
your bitmaps when you're done with them.
     bmp.recycle();
That said, bitmaps do take up a lot of memory, and of course it has to
be contiguous, so you must be careful using them. E.g., use System.gc
() judiciously, etc.

-- Jon Webb


On Apr 9, 4:57 pm, petunio <[email protected]> wrote:
> Hi everybody
>
> I am having a problem with theBitmapFactory:
>
> this is my function, that reads a stream, and returns a bitmap:
>
>         static Bitmap getBitmap(InputStream is) throws IOException
>         {
>            Bitmap bmp=null;
>
>           //do some stuff...
>
>            bmp=BitmapFactory.decodeStream(is);
>
>            return bmp;
>         }
>
> after calling it a few times, it crashes giving me the following
> error:
>
> ERROR/(1329): VM won't let us allocate 215488 bytes
> ERROR/AndroidRuntime(1329): java.lang.OutOfMemoryError: bitmap size
> exceeds VM budget
>
> I am counting thememoryused so far, and it's only 395328 bytes, so I
> am sure there must be something else...
>
> any ideas?
>
> Thanks
--~--~---------~--~----~------------~-------~--~----~
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