Frequent VMDebug.startGC() when creating a bitmap?

My application is active creates a Bitmap from a bytearray or embedded resources.

After testing on different devices found that the performance significantly different on Lenovo IconTab and sgs3 or Samsung Tab 10.1


After running the Profiler was surprised to find that the time of the call to Bitmap.nativeCreate() varies significantly if it is unlocked it is far below the Samsung 3 place. Moreover 97% of CPU time inside it is VMDebug.startGC() which in theory is supposed to be a fake. On the Lenovo I don't see this method.


I tried to run from Android Studio in debug and normal mode. Did release builds and fill them with his hands. Still the performance is equally horrible.


Any idea where to dig and what to look for?
October 3rd 19 at 03:59
2 answers
October 3rd 19 at 04:01
1. Why decode from 100 images and keep them in memory, and not as their appearance on the screen?
2. Use decode options below pictures did not reserve memory for a long time

final BitmapFactory.Options options = new BitmapFactory.Options();
 
// Decode bitmap with inSampleSize set
options.inJustDecodeBounds = false;
 
// #302 added to reduce the amount of OutOfMemory errors
options.inDither = false; // Disable Dithering mode
options.inPurgeable = true; // Tell to gc that whether it needs
                            // free memory, the Bitmap can be
                            // cleared
options.inInputShareable = true; // Which kind of reference will
                                 // be used to recover the Bitmap
                                 // data after being clear, when
                                 // it will be used in the future
options.inTempStorage = new byte[32 * 1024];


3. Consumed memory can be viewed on the Heap tab view. On Your screenshots it is not visible
Well, 100 pictures I will ship purely for example — to highlight the problem place. From memory, I do not experience problems.
And are experiencing a problem with the speed of decoding on some devices. This is a free tile map it. - julien_Altenwerth commented on October 3rd 19 at 04:04
I can only assume, since screenshots of memory consumption You are posted. But if memory runs out, it is quite natural that calls the garbage collector before decoding a new image. - Jammie_McKenzie commented on October 3rd 19 at 04:07
And use LruCache to store images, it automatically cleans the achievement of specified limit. - Jammie_McKenzie commented on October 3rd 19 at 04:10
October 3rd 19 at 04:03
missed

Find more questions by tags AndroidSamsung