Getting I / art: Explicit parallel GC label sweep

I start the service service service => and start checking files in the "new stream". In the log I get the following: the service / application is paused.

Journal: I/art: Explicit concurrent mark sweep GC freed 25935(1686KB) AllocSpace objects, 13(903KB) LOS objects, 39% free, 13MB/22MB, paused 649us total 43.569ms

This is just scanning files in MyData on an SDcard that contain a bunch of photos (about 20 photos).

** Scan = Get pics names and save them in String.

+7
java android android-service
source share
1 answer

All this means that the garbage collector does its job and frees up memory.

If you see this often (or sequentially), then you are probably highlighting too many objects. A common reason is the allocation of many (or several large) objects in a loop as follows:

 for (int i = 0; i < 100; i++) { Bitmap bmp = Bitmap.create(100, 100, Bitmap.Config.ARGB_4444); } 

Each time we fall into this cycle, we highlight one hundred new Bitmap objects.

The best way to prevent GC sweeps is to not select objects. Of course, you need to allocate objects in Java, so you need to make sure that you are not assigning unnecessarily.

Here is one of many YouTube videos that Google has released with tips on preventing GC events and managing memory properly.

+15
source share

All Articles