I have an app that animates gif's by loading all of the frames as separate bitmaps into memory and having a thread loop through them assigning them to the imageViews
.
The imageViews
are on fragments and the fragments are loaded on a pageViewer
. I've set the offscreen limit of the pageviewer to 1 so at most I'm dealing with three fragments/gifs at a time.
Now on the emulator with 2.1 I get this error if all three gifs are in memory at the same time:
11-25 17:28:34.269: E/dalvikvm-heap(524): 292000-byte external allocation too large for this process.
11-25 17:28:34.269: E/(524): VM won't let us allocate 292000 bytes
I get the same error on 2.3.3 but not on 4.0.3 emulator or my galaxy tab 10.1 running 4.0.4 - those two run fine and considerably faster.
I've tried loading a 1024x999 3.2MB gif and even the 4.0.3 emulator failed but my tablet still managed to show a number of gifs until it too stopped loading them; the app used about 250-300MB of RAM.
So is there a way to predict how real devices will work? Should I target higher API versions?