Search code examples
androidgarbage-collectionandroid-runtimepause

Android in ART garbage collection pause time indicates main thread or worker thread?


Does anybody know whether GC log below, "paused 1.439ms", means pause time on background thread that CMS is working on, or pause time on main thread?

I/art: Background sticky concurrent mark sweep GC freed 266189(12MB) AllocSpace objects, 0(0B) LOS objects, 14% free, 46MB/54MB, paused 1.439ms total 179.694m

Thanks a lot in advance!!


Solution

  • There are two kind of GC pauses in ART:

    1) In the log below Explicit concurrent mark sweep GC indicates foreground call.

    I/art(801): Explicit concurrent mark sweep GC freed 65595(3MB) AllocSpace objects, 9(4MB) LOS objects, 810% free, 38MB/58MB, paused 1.195ms total 87.219ms
    

    2) In the logs below Background partial concurrent mark sweep GC and Background sticky concurrent mark sweep GC indicate background call.

    I/art(29197): Background partial concurrent mark sweep GC freed 74626(3MB) AllocSpace objects, 39(4MB) LOS objects, 1496% free, 25MB/32MB, paused 4.422ms total 1.371747s
    
    I/art(29197): Background sticky concurrent mark sweep GC freed 70319(3MB) AllocSpace objects, 59(5MB) LOS objects, 825% free, 49MB/56MB, paused 6.139ms total 52.868ms
    

    Hope this helps you out!