Trying to recreate OOM happening on a Samsung S4 (5.0.1) on an AVD (5.0). Both report MemoryClass 128, but I cannot reproduce the OOM condition on my AVD.
I ended up with a really extreme test bitmap of 6000x4000 (96MB with no inSampling. Sure, not a good idea for production, but this is for testing only) I'm using plain BitmapFactory.
The S4 consistently crashes while loading, not a surprise :)
The weird thing: on the AVD this consistently loads without any problem. I'm always able to allocate huge memory nearly to the limits of available MemoryClass, as if there's not fragmentation at all.
Shouln't devices with identical VM heap size behave similar? There should be no major differences in heap fragementation on both devices, as the App has been freshly installed and started.
I'm quite confused, because it looks like an AVD is not a useful device for testing, at least in terms of memory management in ART.
I might have some basic misunderstanding on MemoryClass and VM Heap size. Any ideas?