Guess what else is the Android-Bitmap-OOM question!
Background
While stress testing our application , it was noted that it is possible to maximize the memory allocation of the application after prolonged, intensive use (monkey runner) with OutOfMemory exceptions are written in the next stack. The application loads images (about 3 at a time) when a page is selected under ViewPager . You can download more than 280 images for download when the length and breath of the application are implemented. The app uses Picasso by Square to download an abstraction image. It is noteworthy that in no case do we manipulate Bitmaps directly in our application code ... we believe that very talented employees of Square Inc. doing it better than we can.
Here is a picture
The following figure shows the heap time distributions recorded in the dalvikvm-heap log message. Red dots indicate that the user is introducing a fresh set of articles into the application to strengthen the amount of work and emphasize the application ...
DALVIKVM heap allocation http://snag.gy/FgsiN.jpg Figure 1: Nexus One heap allocation; OOM occurs at 80 MB +
Study to date
Compared to the Nexus S, Nexus 4, Wildfire, HTC Incredible, and many additional test devices, anonymous testing showed that memory management is enough for the DVM GC to βsupportβ the heavy lifting operation, the application being completed. However, on high-end devices such as the Galaxy S II, III, IV, and HTC One, OOMs are common. In fact, given enough work, I would suggest that all of our devices will ultimately fail.
Question
There is a clear connection between screen density (our requested image sizes are based on ImageView size), the memory allocation of the process, and the number of images with a given size, which will lead to exceeding the application using heap restrictions. I'm going to start quantifying these relationships, but would like the SO community to highlight this issue and (a) agree or disagree that the relationship is worth it, and (b) provide literature indicating how to best compose the relationship .
It is important to note that if we destroy image quality, our OOM all disappear, but, alas, the UX is worse, and that is why we want it to be the most efficient use of the available heap.
Side note: here is the part of the code responsible for loading these images into the laid out views;
picassoInstance.load(entry.getKey()) .resize(imageView.getMeasuredWidth(), imageView.getMeasuredHeight()) .centerCrop() .into(imageView);
Image Quality Deprivation mentioned above simply divides imageView.getMeasured... by a number like "4".