Android / ANR /"完全阻止GC时间"需要几秒钟

时间:2017-01-23 06:22:59

标签: android garbage-collection android-anr-dialog

我得到一个anr,从anr跟踪,主线程是正常的

"main" prio=5 tid=1 Native
  | group="main" sCount=1 dsCount=0 obj=0x7507a710 self=0x7fae13ba00
  | sysTid=12991 nice=0 cgrp=default sched=0/0 handle=0x7fb1746fe8
  | state=S schedstat=( 523201194870 224815705819 1167733 ) utm=35431 stm=16889 core=2 HZ=100
  | stack=0x7fc88a6000-0x7fc88a8000 stackSize=8MB
  | held mutexes=
  kernel: __switch_to+0x7c/0x88
  kernel: SyS_epoll_wait+0x2cc/0x384
  kernel: SyS_epoll_pwait+0x9c/0x114
  kernel: el0_svc_naked+0x20/0x28
  native: #00 pc 0000000000068374  /system/lib64/libc.so (__epoll_pwait+8)
  native: #01 pc 000000000001f3a4  /system/lib64/libc.so (epoll_pwait+32)
  native: #02 pc 000000000001be88  /system/lib64/libutils.so (_ZN7android6Looper9pollInnerEi+144)
  native: #03 pc 000000000001c268  /system/lib64/libutils.so (_ZN7android6Looper8pollOnceEiPiS1_PPv+80)
  native: #04 pc 00000000000d73a8  /system/lib64/libandroid_runtime.so (_ZN7android18NativeMessageQueue8pollOnceEP7_JNIEnvP8_jobjecti+48)
  native: #05 pc 000000000000087c  /system/framework/arm64/boot.oat (Java_android_os_MessageQueue_nativePollOnce__JI+144)
  at android.os.MessageQueue.nativePollOnce(Native method)
  at android.os.MessageQueue.next(MessageQueue.java:323)
  at android.os.Looper.loop(Looper.java:135)
  at android.app.ActivityThread.main(ActivityThread.java:5509)
  at java.lang.reflect.Method.invoke!(Native method)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

虽然文件头中的某些信息表明看似异常

Total mutator paused time: 258.874ms
Total time waiting for GC to complete: 4.645ms
Total GC count: 443
Total GC time: 7.627s
Total blocking GC count: 261
Total blocking GC time: 4.283s
Histogram of GC count per 10000 ms: 0:3395,1:135,2:7,3:86,4:6,5:1,6:1
Histogram of blocking GC count per 10000 ms: 0:3544,3:87

在上面的部分中,跟踪表示"总阻塞GC时间"是4.283s,这是正常情况吗? 这可能与ANR有关吗?

感谢您的支持。

0 个答案:

没有答案