Reputation: 4968
i have a custom list view. in that i am listing out images of around 200. The images are been stored in my drawable. I have converted the image to be a bitmap and i am displaying the image as bitmap. Every time when the activity is being opened the images get listed out. Like this when i am calling the activity for around 10 times it gets crashed and the error is
java.lang.OutOfMemoryError: bitmap size exceeds VM budget
then i recycled the bitmaps and by using System.gs function i got the following
Clamp target GC heap from 25.464MB to 24.000MB
GC freed 322 objects / 70664 bytes in 146ms
Clamp target GC heap from 25.471MB to 24.000MB
GC freed 2 objects / 48 bytes in 138ms
Forcing collection of SoftReferences for 10720-byte allocation
Clamp target GC heap from 25.269MB to 24.000MB
DEBUG/dalvikvm(15311): GC freed 5080 objects / 211168 bytes in 121ms
ERROR/dalvikvm-heap(15311): Out of memory on a 10720-byte allocation
Now atlast i got this Out of memory on a 10720-byte allocation
error
Now how to resolve the error, please help me friends
Upvotes: 3
Views: 7288
Reputation: 21353
Let's run through the checklist for your situation:
Let me think up some more that might be helpful and add later
Upvotes: 2