Reputation: 1706
I'm developing an app which has lots of ImageView
s in its Activity
s, but the sum of their sizes is about 2 MB. when the user clicks on a button another Activity
is going to be shown but the current one restarts and I can see the below error in logcat. what's wrong?!
12-06 17:53:07.224: E/dalvikvm-heap(3938): 7704000-byte external allocation too large for this process.
12-06 17:53:07.224: E/dalvikvm(3938): Out of memory: Heap Size=5895KB, Allocated=3283KB, Bitmap Size=22871KB, Limit=32768KB
12-06 17:53:07.224: E/dalvikvm(3938): Trim info: Footprint=5895KB, Allowed Footprint=5895KB, Trimmed=864KB
12-06 17:53:07.224: E/GraphicsJNI(3938): VM won't let us allocate 7704000 bytes
UPDATE: I'm also using lots of Animations
on these images and playing a background music!
Upvotes: 0
Views: 98
Reputation: 5599
I think the Picasso library (http://square.github.io/picasso/) the best for image loading, it does caching and cleans after you
Upvotes: 0
Reputation: 2251
You mention that the sum of the image sizes is about 2mb. Is this the disk size or actual memory size? Note that when you load an image into memory it uses a lot more than the file saved to disk.
I have successfully used the library below to prevent issues with out of memory.
https://github.com/nostra13/Android-Universal-Image-Loader
Upvotes: 1