聽說,Gingerbread以前, Android GC採用stop-the-world的方式來作垃圾收集,花費時間在100ms左右,而在Gingerbread及以後,GC採用concurrent的方式來作垃圾收集,花費時間較短,在10ms左右。下面是GC 的log,能夠看出,確實是用了concurrent的垃圾收集方式。sed
dalvikvm: GC_CONCURRENT freed 388K, 8% free 6551K/7111K, paused 19ms+2ms, total 45mstop
dalvikvm: GC_CONCURRENT freed 137K, 5% free 6949K/7239K, paused 20ms+3ms, total 53ms時間
dalvikvm: WAIT_FOR_CONCURRENT_GC blocked 15msvi
dalvikvm: GC_CONCURRENT freed 276K, 6% free 7184K/7623K, paused 17ms+2ms, total 46msco
dalvikvm: WAIT_FOR_CONCURRENT_GC blocked 13msblock
dalvikvm: GC_FOR_ALLOC freed 120K, 6% free 7311K/7751K, paused 21ms, total 21ms垃圾收集
dalvikvm: GC_CONCURRENT freed 381K, 9% free 7367K/8007K, paused 13ms+1ms, total 36ms
dalvikvm: WAIT_FOR_CONCURRENT_GC blocked 22ms
dalvikvm: GC_FOR_ALLOC freed 117K, 7% free 7487K/8007K, paused 23ms, total 24ms
dalvikvm: GC_CONCURRENT freed 614K, 10% free 8030K/8903K, paused 25ms+4ms, total 59ms
dalvikvm: GC_CONCURRENT freed 430K, 7% free 8315K/8903K, paused 18ms+14ms, total 78ms
dalvikvm: WAIT_FOR_CONCURRENT_GC blocked 2ms
dalvikvm: GC_CONCURRENT freed 185K, 4% free 8954K/9287K, paused 14ms+3ms, total 70ms
dalvikvm: WAIT_FOR_CONCURRENT_GC blocked 18ms