web-dev-qa-db-ja.com

停止したサービスが継続的なガベージコレクションを実行しています

私は多くのサービスを持つアプリケーションを開発しています。インテントサービスを停止すると、すべてのスレッドとサービスが停止するはずですが、UIがハングし、logcatに次のエラーが記録されます。

2014-12-01 12: 37: 92I/art     (32099): Background partial concurrent mark sweep GC freed 419756(33MB) AllocSpace objects, 15(4MB) LOS objects, 38% free, 25MB/41MB, paused 1.617ms total 451.976ms
2014-12-01 12: 37: 40I/art     (32099): Background sticky concurrent mark sweep GC freed 290680(16MB) AllocSpace objects, 0(0B) LOS objects, 23% free, 25MB/33MB, paused 23.287ms total 229.513ms
2014-12-01 12: 37: 29I/art     (32099): Background partial concurrent mark sweep GC freed 165880(9MB) AllocSpace objects, 0(0B) LOS objects, 39% free, 23MB/39MB, paused 1.648ms total 203.601ms
2014-12-01 12: 37: 54I/art     (32099): Background sticky concurrent mark sweep GC freed 269770(15MB) AllocSpace objects, 0(0B) LOS objects, 24% free, 24MB/32MB, paused 2.533ms total 207.538ms
2014-12-01 12: 37: 54I/art     (32099): WaitForGcToComplete blocked for 170.151ms for cause HeapTrim
2014-12-01 12: 37: 22I/art     (32099): Background partial concurrent mark sweep GC freed 155347(8MB) AllocSpace objects, 0(0B) LOS objects, 40% free, 23MB/39MB, paused 1.464ms total 181.474ms
2014-12-01 12: 38: 45I/art     (32099): Background sticky concurrent mark sweep GC freed 267766(15MB) AllocSpace objects, 0(0B) LOS objects, 24% free, 24MB/32MB, paused 1.556ms total 149.855ms
2014-12-01 12: 38: 11I/art     (32099): Background sticky concurrent mark sweep GC freed 137696(7MB) AllocSpace objects, 0(0B) LOS objects, 24% free, 24MB/32MB, paused 1.617ms total 125.255ms
2014-12-01 12: 38: 82I/art     (32099): Background partial concurrent mark sweep GC freed 148859(8MB) AllocSpace objects, 0(0B) LOS objects, 39% free, 23MB/39MB, paused 1.373ms total 216.542ms
2014-12-01 12: 38: 11I/art     (32099): Background sticky concurrent mark sweep GC freed 276636(15MB) AllocSpace objects, 0(0B) LOS objects, 24% free, 24MB/32MB, paused 1.403ms total 156.661ms
2014-12-01 12: 38: 97I/art     (32099): Background sticky concurrent mark sweep GC freed 139573(7MB) AllocSpace objects, 0(0B) LOS objects, 24% free, 24MB/32MB, paused 1.464ms total 115.336ms
2014-12-01 12: 38: 85I/art     (32099): Background partial concurrent mark sweep GC freed 151267(8MB) AllocSpace objects, 0(0B) LOS objects, 39% free, 23MB/39MB, paused 2.227ms total 210.346ms
2014-12-01 12: 38: 44I/art     (32099): Background sticky concurrent mark sweep GC freed 268102(15MB) AllocSpace objects, 0(0B) LOS objects, 24% free, 24MB/32MB, paused 1.495ms total 148.542ms
2014-12-01 12: 38: 27I/art     (32099): Background sticky concurrent mark sweep GC freed 137761(7MB) AllocSpace objects, 0(0B) LOS objects, 24% free, 24MB/32MB, paused 1.587ms total 119.121ms
2014-12-01 12: 38: 26I/art     (32099): Background partial concurrent mark sweep GC freed 154492(9MB) AllocSpace objects, 0(0B) LOS objects, 39% free, 23MB/39MB, paused 2.533ms total 314.939ms
2014-12-01 12: 38: 75I/art     (32099): Thread[5,tid=32108,WaitingInMainSignalCatcherLoop,Thread*=0xb8111d98,peer=0x12c07080,"Signal Catcher"]: reacting to signal 3
2014-12-01 12: 38: 79W/art     (32099): Suspending all threads took: 13.062ms
2014-12-01 12: 38: 80I/art     (32099): Wrote stack traces to '/data/anr/traces.txt'
2014-12-01 12: 38: 89I/art     (32099): Background sticky concurrent mark sweep GC freed 278516(15MB) AllocSpace objects, 0(0B) LOS objects, 25% free, 23MB/31MB, paused 2.533ms total 1.049s
2014-12-01 12: 38: 13I/art     (32099): Background partial concurrent mark sweep GC freed 137132(8MB) AllocSpace objects, 0(0B) LOS objects, 40% free, 23MB/39MB, paused 4.211ms total 188.951ms
2014-12-01 12: 38: 42I/art     (32099): Background sticky concurrent mark sweep GC freed 271335(15MB) AllocSpace objects, 0(0B) LOS objects, 24% free, 24MB/32MB, paused 3.998ms total 236.868ms
2014-12-01 12: 38: 41I/art     (32099): Background sticky concurrent mark sweep GC freed 143812(8MB) AllocSpace objects, 0(0B) LOS objects, 23% free, 24MB/32MB, paused 6.470ms total 201.800ms
2014-12-01 12: 38: 36I/art     (32099): Background partial concurrent mark sweep GC freed 159223(9MB) AllocSpace objects, 0(0B) LOS objects, 39% free, 23MB/39MB, paused 5.524ms total 215.809ms
2014-12-01 12: 38: 61I/art     (32099): Background sticky concurrent mark sweep GC freed 278158(15MB) AllocSpace objects, 0(0B) LOS objects, 24% free, 24MB/32MB, paused 1.922ms total 201.617ms
2014-12-01 12: 38: 41I/art     (32099): WaitForGcToComplete blocked for 46.696ms for cause HeapTrim
2014-12-01 12: 38: 79I/art     (32099): Background sticky concurrent mark sweep GC freed 136821(7MB) AllocSpace objects, 0(0B) LOS objects, 23% free, 24MB/32MB, paused 1.709ms total 123.729ms
2014-12-01 12: 38: 30I/art     (32099): Background sticky concurrent mark sweep GC freed 116947(6MB) AllocSpace objects, 0(0B) LOS objects, 20% free, 25MB/32MB, paused 5.554ms total 138.501ms
2014-12-01 12: 38: 44I/art     (32099): Background sticky concurrent mark sweep GC freed 117175(6MB) AllocSpace objects, 0(0B) LOS objects, 19% free, 25MB/32MB, paused 1.678ms total 104.257ms
2014-12-01 12: 38: 19I/art     (32099): Background sticky concurrent mark sweep GC freed 110760(6MB) AllocSpace objects, 0(0B) LOS objects, 18% free, 26MB/32MB, paused 1.587ms total 104.959ms
2014-12-01 12: 39: 37I/art     (32099): Background sticky concurrent mark sweep GC freed 88168(4MB) AllocSpace objects, 0(0B) LOS objects, 15% free, 27MB/32MB, paused 3.876ms total 114.878ms
2014-12-01 12: 39: 54I/art     (32099): Background partial concurrent mark sweep GC freed 136364(8MB) AllocSpace objects, 0(0B) LOS objects, 39% free, 23MB/39MB, paused 1.648ms total 102.212ms
2014-12-01 12: 39: 60I/art     (32099): Background sticky concurrent mark sweep GC freed 287788(15MB) AllocSpace objects, 0(0B) LOS objects, 24% free, 24MB/32MB, paused 3.418ms total 196.154ms
2014-12-01 12: 39: 80I/art     (32099): Background sticky concurrent mark sweep GC freed 156308(8MB) AllocSpace objects, 0(0B) LOS objects, 25% free, 23MB/31MB, paused 3.998ms total 184.495ms
2014-12-01 12: 39: 33I/art     (32099): Background partial concurrent mark sweep GC freed 148206(8MB) AllocSpace objects, 0(0B) LOS objects, 39% free, 23MB/39MB, paused 1.831ms total 103.738ms
2014-12-01 12: 39: 59I/art     (32099): Background sticky concurrent mark sweep GC freed 283901(15MB) AllocSpace objects, 0(0B) LOS objects, 25% free, 23MB/31MB, paused 2.502ms total 144.086ms
2014-12-01 12: 39: 43I/art     (32099): Background sticky concurrent mark sweep GC freed 134828(7MB) AllocSpace objects, 0(0B) LOS objects, 24% free, 24MB/31MB, paused 2.533ms total 130.291ms
2014-12-01 12: 39: 44I/art     (32099): WaitForGcToComplete blocked for 94.277ms for cause HeapTrim
2014-12-01 12: 39: 95I/art     (32099): Background sticky concurrent mark sweep GC freed 133441(7MB) AllocSpace objects, 0(0B) LOS objects, 23% free, 24MB/31MB, paused 5.035ms total 139.722ms
2014-12-01 12: 39: 47I/art     (32099): Background partial concurrent mark sweep GC freed 148395(8MB) AllocSpace objects, 0(0B) LOS objects, 40% free, 23MB/39MB, paused 2.227ms total 122.722ms
2014-12-01 12: 39: 79I/art     (32099): Background sticky concurrent mark sweep GC freed 280706(15MB) AllocSpace objects, 0(0B) LOS objects, 24% free, 24MB/32MB, paused 1.495ms total 175.156ms
2014-12-01 12: 39: 44I/art     (32099): Background sticky concurrent mark sweep GC freed 144094(8MB) AllocSpace objects, 0(0B) LOS objects, 24% free, 24MB/32MB, paused 2.258ms total 140.119ms
2014-12-01 12: 39: 06I/art     (32099): Background partial concurrent mark sweep GC freed 152123(8MB) AllocSpace objects, 0(0B) LOS objects, 40% free, 23MB/39MB, paused 1.892ms total 108.957ms
2014-12-01 12: 39: 99I/art     (32099): Background sticky concurrent mark sweep GC freed 281291(15MB) AllocSpace objects, 0(0B) LOS objects, 25% free, 23MB/31MB, paused 6.104ms total 201.190ms
2014-12-01 12: 39: 02I/art     (32099): Background sticky concurrent mark sweep GC freed 136650(7MB) AllocSpace objects, 0(0B) LOS objects, 24% free, 24MB/31MB, paused 41.049ms total 120.372ms
2014-12-01 12: 39: 56I/art     (32099): Background sticky concurrent mark sweep GC freed 134333(7MB) AllocSpace objects, 0(0B) LOS objects, 23% free, 24MB/31MB, paused 1.831ms total 130.260ms
2014-12-01 12: 39: 15I/art     (32099): Background partial concurrent mark sweep GC freed 145994(8MB) AllocSpace objects, 0(0B) LOS objects, 39% free, 24MB/40MB, paused 1.800ms total 302.243ms
2014-12-01 12: 39: 49I/art     (32099): Background sticky concurrent mark sweep GC freed 285630(15MB) AllocSpace objects, 0(0B) LOS objects, 24% free, 24MB/32MB, paused 2.716ms total 235.434ms
2014-12-01 12: 39: 30I/art     (32099): Background sticky concurrent mark sweep GC freed 147718(8MB) AllocSpace objects, 0(0B) LOS objects, 24% free, 24MB/32MB, paused 3.845ms total 176.560ms
2014-12-01 12: 39: 94I/art     (32099): Background partial concurrent mark sweep GC freed 157542(9MB) AllocSpace objects, 0(0B) LOS objects, 39% free, 23MB/39MB, paused 1.831ms total 178.879ms
2014-12-01 12: 39: 39I/art     (32099): Background sticky concurrent mark sweep GC freed 278485(15MB) AllocSpace objects, 0(0B) LOS objects, 24% free, 24MB/32MB, paused 1.495ms total 219.105ms
2014-12-01 12: 39: 90I/art     (32099): Background sticky concurrent mark sweep GC freed 147110(8MB) AllocSpace objects, 0(0B) LOS objects, 24% free, 24MB/32MB, paused 1.495ms total 143.293ms
2014-12-01 12: 39: 44I/art     (32099): Background sticky concurrent mark sweep GC freed 139322(7MB) AllocSpace objects, 0(0B) LOS objects, 23% free, 24MB/32MB, paused 2.197ms total 171.036ms
2014-12-01 12: 39: 10I/art     (32099): Background partial concurrent mark sweep GC freed 155748(9MB) AllocSpace objects, 0(0B) LOS objects, 39% free, 24MB/40MB, paused 4.455ms total 268.915ms
2014-12-01 12: 39: 06I/art     (32099): Background sticky concurrent mark sweep GC freed 283584(15MB) AllocSpace objects, 0(0B) LOS objects, 24% free, 24MB/32MB, paused 1.770ms total 226.094ms
2014-12-01 12: 39: 13I/art     (32099): Background sticky concurrent mark sweep GC freed 14809(850KB) AllocSpace objects, 0(0B) LOS objects, 24% free, 24MB/32MB, paused 5.920ms total 63.573ms
2014-12-01 12: 40: 05I/art     (32099): Background partial concurrent mark sweep GC freed 149252(8MB) AllocSpace objects, 0(0B) LOS objects, 39% free, 23MB/39MB, paused 1.556ms total 177.445ms
2014-12-01 12: 40: 74I/art     (32099): Background sticky concurrent mark sweep GC freed 277718(15MB) AllocSpace objects, 0(0B) LOS objects, 24% free, 24MB/32MB, paused 3.631ms total 164.901ms
2014-12-01 12: 40: 29I/art     (32099): Background sticky concurrent mark sweep GC freed 144490(8MB) AllocSpace objects, 0(0B) LOS objects, 24% free, 24MB/32MB, paused 1.464ms total 134.198ms
2014-12-01 12: 40: 81I/art     (32099): Background sticky concurrent mark sweep GC freed 139991(7MB) AllocSpace objects, 0(0B) LOS objects, 23% free, 24MB/32MB, paused 1.709ms total 127.941ms
2014-12-01 12: 40: 38I/art     (32099): Background sticky concurrent mark sweep GC freed 135726(7MB) AllocSpace objects, 0(0B) LOS objects, 22% free, 25MB/32MB, paused 1.495ms total 168.411ms
2014-12-01 12: 40: 86I/art     (32099): Background partial concurrent mark sweep GC freed 155118(9MB) AllocSpace objects, 0(0B) LOS objects, 39% free, 23MB/39MB, paused 1.403ms total 217.701ms
2014-12-01 12: 40: 10I/art     (32099): Background sticky concurrent mark sweep GC freed 277621(15MB) AllocSpace objects, 0(0B) LOS objects, 24% free, 24MB/32MB, paused 5.035ms total 199.694ms
2014-12-01 12: 40: 91I/art     (32099): Background sticky concurrent mark sweep GC freed 137844(7MB) AllocSpace objects, 0(0B) LOS objects, 23% free, 24MB/32MB, paused 1.342ms total 137.830ms
2014-12-01 12: 40: 51I/art     (32099): Background sticky concurrent mark sweep GC freed 133133(7MB) AllocSpace objects, 0(0B) LOS objects, 22% free, 24MB/32MB, paused 1.892ms total 161.056ms
2014-12-01 12: 40: 92I/art     (32099): Background partial concurrent mark sweep GC freed 148389(8MB) AllocSpace objects, 0(0B) LOS objects, 39% free, 24MB/40MB, paused 2.105ms total 201.587ms
2014-12-01 12: 40: 00I/art     (32099): Background sticky concurrent mark sweep GC freed 286110(15MB) AllocSpace objects, 0(0B) LOS objects, 24% free, 24MB/32MB, paused 3.082ms total 269.739ms
2014-12-01 12: 40: 88I/art     (32099): Background sticky concurrent mark sweep GC freed 147157(8MB) AllocSpace objects, 0(0B) LOS objects, 24% free, 24MB/32MB, paused 1.403ms total 142.682ms
2014-12-01 12: 40: 23W/art     (32099): Suspending all threads took: 20.692ms
2014-12-01 12: 40: 38I/art     (32099): Background sticky concurrent mark sweep GC freed 142717(7MB) AllocSpace objects, 0(0B) LOS objects, 23% free, 25MB/32MB, paused 26.003ms total 177.750ms
2014-12-01 12: 40: 04I/art     (32099): Background partial concurrent mark sweep GC freed 152961(8MB) AllocSpace objects, 0(0B) LOS objects, 39% free, 24MB/40MB, paused 3.692ms total 252.952ms
2014-12-01 12: 40: 36I/art     (32099): Background sticky concurrent mark sweep GC freed 285533(15MB) AllocSpace objects, 0(0B) LOS objects, 24% free, 24MB/32MB, paused 1.190ms total 201.770ms
2014-12-01 12: 40: 01I/art     (32099): Background sticky concurrent mark sweep GC freed 142805(7MB) AllocSpace objects, 0(0B) LOS objects, 23% free, 25MB/32MB, paused 3.876ms total 194.781ms
2014-12-01 12: 40: 57I/art     (32099): Background partial concurrent mark sweep GC freed 154279(8MB) AllocSpace objects, 0(0B) LOS objects, 40% free, 23MB/39MB, paused 2.716ms total 242.118ms
2014-12-01 12: 40: 46I/art     (32099): Background sticky concurrent mark sweep GC freed 282196(15MB) AllocSpace objects, 0(0B) LOS objects, 24% free, 25MB/33MB, paused 1.861ms total 261.071ms
2014-12-01 12: 40: 05I/art     (32099): Background sticky concurrent mark sweep GC freed 150004(8MB) AllocSpace objects, 0(0B) LOS objects, 24% free, 24MB/32MB, paused 1.617ms total 153.059ms
2014-12-01 12: 40: 88I/art     (32099): Background sticky concurrent mark sweep GC freed 141501(7MB) AllocSpace objects, 0(0B) LOS objects, 23% free, 24MB/32MB, paused 3.204ms total 143.842ms
2014-12-01 12: 40: 32I/art     (32099): Background sticky concurrent mark sweep GC freed 137981(7MB) AllocSpace objects, 0(0B) LOS objects, 23% free, 25MB/32MB, paused 1.861ms total 121.806ms
2014-12-01 12: 40: 07I/art     (32099): Background sticky concurrent mark sweep GC freed 132198(7MB) AllocSpace objects, 0(0B) LOS objects, 22% free, 25MB/32MB, paused 1.526ms total 125.133ms
2014-12-01 12: 40: 07I/art     (32099): WaitForGcToComplete blocked for 25.515ms for cause HeapTrim
2014-12-01 12: 40: 53I/art     (32099): Background sticky concurrent mark sweep GC freed 128414(7MB) AllocSpace objects, 0(0B) LOS objects, 21% free, 25MB/32MB, paused 2.716ms total 162.520ms
2014-12-01 12: 40: 16I/art     (32099): Background partial concurrent mark sweep GC freed 153325(9MB) AllocSpace objects, 0(0B) LOS objects, 39% free, 24MB/40MB, paused 1.770ms total 241.812ms
2014-12-01 12: 40: 14I/art     (32099): Background sticky concurrent mark sweep GC freed 281944(15MB) AllocSpace objects, 0(0B) LOS objects, 24% free, 25MB/33MB, paused 1.464ms total 234.915ms
2014-12-01 12: 40: 59I/art     (32099): Background sticky concurrent mark sweep GC freed 152568(8MB) AllocSpace objects, 0(0B) LOS objects, 24% free, 24MB/32MB, paused 11.628ms total 135.602ms
2014-12-01 12: 40: 29I/art     (32099): Background sticky concurrent mark sweep GC freed 140163(7MB) AllocSpace objects, 0(0B) LOS objects, 23% free, 24MB/32MB, paused 2.319ms total 162.826ms
2014-12-01 12: 40: 92I/art     (32099): Background sticky concurrent mark sweep GC freed 134281(7MB) AllocSpace objects, 0(0B) LOS objects, 22% free, 25MB/32MB, paused 1.983ms total 185.685ms
2014-12-01 12: 40: 39I/art     (32099): Background partial concurrent mark sweep GC freed 151800(8MB) AllocSpace objects, 0(0B) LOS objects, 39% free, 24MB/40MB, paused 5.585ms total 294.216ms
2014-12-01 12: 40: 56I/art     (32099): Background sticky concurrent mark sweep GC freed 286752(15MB) AllocSpace objects, 0(0B) LOS objects, 24% free, 24MB/32MB, paused 1.373ms total 241.385ms
2014-12-01 12: 41: 28I/art     (32099): Background sticky concurrent mark sweep GC freed 144618(8MB) AllocSpace objects, 0(0B) LOS objects, 24% free, 24MB/32MB, paused 3.082ms total 109.446ms
2014-12-01 12: 41: 97I/art     (32099): Background sticky concurrent mark sweep GC freed 136091(7MB) AllocSpace objects, 0(0B) LOS objects, 23% free, 24MB/32MB, paused 1.190ms total 134.381ms
2014-12-01 12: 41: 64I/art     (32099): Background sticky concurrent mark sweep GC freed 134936(7MB) AllocSpace objects, 0(0B) LOS objects, 22% free, 25MB/32MB, paused 1.251ms total 105.356ms
2014-12-01 12: 41: 00I/art     (32099): WaitForGcToComplete blocked for 5.035ms for cause HomogeneousSpaceCompact
2014-12-01 12: 41: 51I/art     (32099): Background sticky concurrent mark sweep GC freed 124518(6MB) AllocSpace objects, 0(0B) LOS objects, 21% free, 24MB/31MB, paused 1.739ms total 130.566ms
2014-12-01 12: 41: 85I/art     (32099): Background sticky concurrent mark sweep GC freed 112812(6MB) AllocSpace objects, 0(0B) LOS objects, 20% free, 25MB/31MB, paused 1.251ms total 105.631ms
2014-12-01 12: 41: 09I/art     (32099): Background sticky concurrent mark sweep GC freed 104949(5MB) AllocSpace objects, 0(0B) LOS objects, 18% free, 25MB/31MB, paused 2.350ms total 141.400ms
2014-12-01 12: 41: 40I/art     (32099): Background partial concurrent mark sweep GC freed 125914(7MB) AllocSpace objects, 0(0B) LOS objects, 39% free, 23MB/39MB, paused 1.434ms total 137.158ms
2014-12-01 12: 41: 87W/art     (32099): Suspending all threads took: 19.502ms
2014-12-01 12: 41: 05I/art     (32099): Background sticky concurrent mark sweep GC freed 276391(15MB) AllocSpace objects, 0(0B) LOS objects, 24% free, 24MB/32MB, paused 24.050ms total 233.969ms
2014-12-01 12: 41: 10I/art     (32099): Background sticky concurrent mark sweep GC freed 140307(7MB) AllocSpace objects, 0(0B) LOS objects, 23% free, 25MB/32MB, paused 1.678ms total 117.900ms
2014-12-01 12: 41: 68I/art     (32099): Background sticky concurrent mark sweep GC freed 132233(7MB) AllocSpace objects, 0(0B) LOS objects, 22% free, 25MB/32MB, paused 1.617ms total 111.521ms
2014-12-01 12: 41: 32I/art     (32099): Background sticky concurrent mark sweep GC freed 127744(7MB) AllocSpace objects, 0(0B) LOS objects, 22% free, 25MB/32MB, paused 1.587ms total 110.880ms
2014-12-01 12: 41: 62I/art     (32099): Background sticky concurrent mark sweep GC freed 124145(6MB) AllocSpace objects, 0(0B) LOS objects, 21% free, 25MB/32MB, paused 4.883ms total 117.869ms
2014-12-01 12: 41: 88I/art     (32099): Background sticky concurrent mark sweep GC freed 114064(6MB) AllocSpace objects, 0(0B) LOS objects, 19% free, 26MB/32MB, paused 1.709ms total 121.898ms
2014-12-01 12: 41: 61I/art     (32099): Background sticky concurrent mark sweep GC freed 106523(5MB) AllocSpace objects, 0(0B) LOS objects, 18% free, 26MB/32MB, paused 2.166ms total 131.817ms
2014-12-01 12: 41: 34I/art     (32099): Background sticky concurrent mark sweep GC freed 99159(5MB) AllocSpace objects, 0(0B) LOS objects, 16% free, 27MB/32MB, paused 1.617ms total 132.702ms
2014-12-01 12: 41: 60I/art     (32099): Background partial concurrent mark sweep GC freed 135913(8MB) AllocSpace objects, 0(0B) LOS objects, 39% free, 23MB/39MB, paused 1.281ms total 145.856ms
2014-12-01 12: 41: 40I/art     (32099): Background sticky concurrent mark sweep GC freed 276563(15MB) AllocSpace objects, 0(0B) LOS objects, 24% free, 24MB/32MB, paused 6.775ms total 194.170ms
2014-12-01 12: 41: 40I/art     (32099): WaitForGcToComplete blocked for 41.721ms for cause HeapTrim
2014-12-01 12: 41: 62I/art     (32099): Background sticky concurrent mark sweep GC freed 135682(7MB) AllocSpace objects, 0(0B) LOS objects, 23% free, 25MB/32MB, paused 1.648ms total 105.508ms
2014-12-01 12: 41: 99I/art     (32099): Background sticky concurrent mark sweep GC freed 131287(7MB) AllocSpace objects, 0(0B) LOS objects, 22% free, 25MB/32MB, paused 2.441ms total 123.241ms
2014-12-01 12: 41: 55I/art     (32099): Background sticky concurrent mark sweep GC freed 128189(7MB) AllocSpace objects, 0(0B) LOS objects, 21% free, 25MB/32MB, paused 2.685ms total 159.987ms
2014-12-01 12: 41: 93I/art     (32099): Background partial concurrent mark sweep GC freed 146571(8MB) AllocSpace objects, 0(0B) LOS objects, 39% free, 24MB/40MB, paused 21.638ms total 212.330ms
2014-12-01 12: 42: 03I/art     (32099): Background sticky concurrent mark sweep GC freed 282301(15MB) AllocSpace objects, 0(0B) LOS objects, 24% free, 24MB/32MB, paused 4.394ms total 191.423ms
2014-12-01 12: 42: 46I/art     (32099): Background sticky concurrent mark sweep GC freed 144030(8MB) AllocSpace objects, 0(0B) LOS objects, 24% free, 24MB/32MB, paused 1.312ms total 105.020ms
2014-12-01 12: 42: 16I/art     (32099): Background sticky concurrent mark sweep GC freed 135791(7MB) AllocSpace objects, 0(0B) LOS objects, 23% free, 24MB/32MB, paused 5.096ms total 134.198ms
2014-12-01 12: 42: 77I/art     (32099): Background sticky concurrent mark sweep GC freed 132569(7MB) AllocSpace objects, 0(0B) LOS objects, 22% free, 25MB/32MB, paused 1.312ms total 113.871ms
2014-12-01 12: 42: 49I/art     (32099): Background partial concurrent mark sweep GC freed 158851(9MB) AllocSpace objects, 0(0B) LOS objects, 39% free, 24MB/40MB, paused 3.540ms total 222.890ms
2014-12-01 12: 42: 79I/art     (32099): Background sticky concurrent mark sweep GC freed 282779(15MB) AllocSpace objects, 0(0B) LOS objects, 24% free, 25MB/33MB, paused 3.082ms total 205.371ms
2014-12-01 12: 42: 31I/art     (32099): Background sticky concurrent mark sweep GC freed 145527(8MB) AllocSpace objects, 0(0B) LOS objects, 24% free, 24MB/32MB, paused 1.648ms total 111.857ms
2014-12-01 12: 42: 93I/art     (32099): Background sticky concurrent mark sweep GC freed 136635(7MB) AllocSpace objects, 0(0B) LOS objects, 23% free, 25MB/32MB, paused 1.770ms total 109.415ms
2014-12-01 12: 42: 38I/art     (32099): Background sticky concurrent mark sweep GC freed 131901(7MB) AllocSpace objects, 0(0B) LOS objects, 22% free, 25MB/32MB, paused 2.044ms total 129.558ms
2014-12-01 12: 42: 93I/art     (32099): Background sticky concurrent mark sweep GC freed 127795(7MB) AllocSpace objects, 0(0B) LOS objects, 21% free, 25MB/32MB, paused 3.509ms total 128.734ms
2014-12-01 12: 42: 31I/art     (32099): Background sticky concurrent mark sweep GC freed 123525(6MB) AllocSpace objects, 0(0B) LOS objects, 21% free, 25MB/32MB, paused 1.678ms total 112.131ms
2014-12-01 12: 42: 61I/art     (32099): Background sticky concurrent mark sweep GC freed 120526(6MB) AllocSpace objects, 0(0B) LOS objects, 20% free, 26MB/32MB, paused 3.174ms total 112.406ms
2014-12-01 12: 42: 77I/art     (32099): Background sticky concurrent mark sweep GC freed 117214(6MB) AllocSpace objects, 0(0B) LOS objects, 19% free, 26MB/32MB, paused 2.685ms total 155.501ms
2014-12-01 12: 42: 27I/art     (32099): Background partial concurrent mark sweep GC freed 146608(8MB) AllocSpace objects, 0(0B) LOS objects, 39% free, 24MB/40MB, paused 1.373ms total 148.359ms
2014-12-01 12: 42: 84I/art     (32099): Background sticky concurrent mark sweep GC freed 277503(15MB) AllocSpace objects, 0(0B) LOS objects, 24% free, 24MB/32MB, paused 35.006ms total 188.402ms
2014-12-01 12: 42: 49I/art     (32099): Background sticky concurrent mark sweep GC freed 139325(7MB) AllocSpace objects, 0(0B) LOS objects, 24% free, 24MB/32MB, paused 2.319ms total 125.194ms
2014-12-01 12: 42: 98I/art     (32099): Background sticky concurrent mark sweep GC freed 134919(7MB) AllocSpace objects, 0(0B) LOS objects, 23% free, 25MB/32MB, paused 3.357ms total 129.192ms
2014-12-01 12: 42: 01I/art     (32099): Background sticky concurrent mark sweep GC freed 127642(7MB) AllocSpace objects, 0(0B) LOS objects, 21% free, 25MB/32MB, paused 1.434ms total 125.133ms
2014-12-01 12: 42: 23I/art     (32099): Background sticky concurrent mark sweep GC freed 125587(6MB) AllocSpace objects, 0(0B) LOS objects, 21% free, 25MB/32MB, paused 2.350ms total 123.363ms
2014-12-01 12: 42: 79I/art     (32099): Background sticky concurrent mark sweep GC freed 119217(6MB) AllocSpace objects, 0(0B) LOS objects, 20% free, 26MB/32MB, paused 5.615ms total 127.819ms
2014-12-01 12: 42: 01I/art     (32099): Background sticky concurrent mark sweep GC freed 115621(6MB) AllocSpace objects, 0(0B) LOS objects, 19% free, 26MB/32MB, paused 1.800ms total 124.889ms
2014-12-01 12: 42: 50I/art     (32099): Background sticky concurrent mark sweep GC freed 109559(6MB) AllocSpace objects, 0(0B) LOS objects, 19% free, 26MB/32MB, paused 1.495ms total 103.708ms
2014-12-01 12: 42: 71I/art     (32099): Background sticky concurrent mark sweep GC freed 103671(5MB) AllocSpace objects, 0(0B) LOS objects, 17% free, 27MB/32MB, paused 4.028ms total 137.524ms
2014-12-01 12: 42: 84I/art     (32099): Background partial concurrent mark sweep GC freed 140033(8MB) AllocSpace objects, 0(0B) LOS objects, 39% free, 24MB/40MB, paused 1.648ms total 222.646ms
2014-12-01 12: 42: 79I/art     (32099): Background sticky concurrent mark sweep GC freed 285098(15MB) AllocSpace objects, 0(0B) LOS objects, 24% free, 24MB/32MB, paused 12.055ms total 181.199ms
2014-12-01 12: 42: 24I/art     (32099): Background sticky concurrent mark sweep GC freed 143445(7MB) AllocSpace objects, 0(0B) LOS objects, 24% free, 24MB/32MB, paused 1.556ms total 119.517ms
2014-12-01 12: 42: 75I/art     (32099): Background sticky concurrent mark sweep GC freed 138529(7MB) AllocSpace objects, 0(0B) LOS objects, 23% free, 25MB/32MB, paused 1.892ms total 128.673ms

何が問題なのでしょうか?そして、どのように修正できますか?

24
Harshit Rathi

アプリのプロファイル-私の似たような問題の原因をそのように見つけました。

Android Studio:ツール-> Android-> Android Device Monitor

アプリを選択し、上部(左)で次を選択します。

メソッドプロファイリングを開始する

しばらくして停止すると、結果が表示されます。

7

私にも同じ問題が発生しました。しかし、私はSqLiteを使用しています。エンティティのリストを選択するときに、いくつかの重要なメソッドを追加するのを忘れました。問題が発生したとき、私のコードは次のとおりです

 public List<Blocked> getBlockeds() {
    List<Blocked> blockeds = new ArrayList<>();
    String[] allColumns = {"id", "phoneNumber"};
    Cursor cursor = database.query("Blockeds", allColumns, null, null, null, null, "id desc");
    cursor.moveToFirst();
    while (!cursor.isAfterLast()) {
        Blocked blocked = new CursorToPojo().cursorToBlocked(cursor);
        blockeds.add(blocked);
    }
    return blockeds;
}

問題を解決するためにコードを変更するとき。

public List<Blocked> getBlockeds() {
    List<Blocked> blockeds = new ArrayList<>();
    String[] allColumns = {"id", "phoneNumber"};
    Cursor cursor = database.query("Blockeds", allColumns, null, null, null, null, "id desc");
    cursor.moveToFirst();
    while (!cursor.isAfterLast()) {
        Blocked blocked = new CursorToPojo().cursorToBlocked(cursor);
        blockeds.add(blocked);
        cursor.moveToNext();
    }
    cursor.close();
    return blockeds;
}

cursor.moveToNextカーソルを使用しなかった場合、カーソルが終了せず、前述の問題が発生することに気付きました。

1
Afsun Khammadli

サービスを停止する必要があるときにIntentサービスを使用する理由がわかりません。ただし、まだ実行する必要があると思われる場合は、onhandleIntent自体からstopself()を呼び出すか(これによりプロトコルが再度中断されます)、またはアクティビティから呼び出すことができます(保留中のキュー処理を停止する傾向があります) 。

ライフサイクル全体を管理する必要がある場合は、境界のあるサービスを使用します。リファレンスは次のとおりです。

http://developer.Android.com/guide/topics/fundamentals/services.html

0