[android-developers] Strange out of memory on bitmap but there is free heap space
Hi,
I have a list view that display about 25 images with size 60x60 pixels.
I dowload this images from internet and I store in an arraylist as
Bitmap. I need to save it in a arraylist because a listview will recycle
views and so I need, wenn the user scroll, to display the image
in the new view WITHOUT downloading again from internet
But after some time I got
java.lang.OutOfMemoryError: bitmap size exceeds VM budget
It seams that I got this exception about after loading 20 images ...
Reading in forum I have read about memory heap.
I try to check the memory heap usage with:
Debug.getNativeHeapAllocatedSize
and
Debug.getNativeHeapSize()
When the exception occours both are about 4M.
But android has more than 4M?
When the application start the values are a little less to 4M so it seams is not
a big memory usage or memory leak.
To be sure I want to call :
ActivityManager.getMemoryClass()
but this method is and instance method and I can't find the object to invoke!!!
But this method say, that al min should an application have 16M!
Any help? I have seen many topics in google ... but all speak about
recycle. But if
I recycle a bitmat ... then should I download again from internet?
Should I store the image on flash memory or sd card instead an
arraylist in memory?
--
_| _. o _| _
(_| (_| \/ | (_| (/_
--
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