gpt4 book ai didi

java - WaitForGcToComplete 因 DisableMovingGc 而阻塞 89.851 毫秒

转载 作者:搜寻专家 更新时间:2023-11-01 09:48:45 35 4
gpt4 key购买 nike

<分区>

我有两个版本的应用程序,付费版和免费版。两个版本共享相同的通知服务代码。一个版本正在运行,另一个版本似乎运行了代码并启动了显示警报的方法,但这从未向用户显示,而是我在 logcat 中得到了这个:

20:23:51.926 I/art: WaitForGcToComplete blocked for 5.737ms for cause DisableMovingGc
04-20 20:23:54.531 I/art: Thread[5,tid=12452,WaitingInMainSignalCatcherLoop,Thread*=0xb7e9eec0,peer=0x32c0a0a0,"Signal Catcher"]: reacting to signal 3
04-20 20:23:54.755 I/art: Wrote stack traces to '/data/anr/traces.txt'

应用程序的其他方面有很多差异,但最近添加的一项是混合面板跟踪,我在过去看到它与垃圾收集问题有关。这在两个应用程序中都存在,但每个应用程序中的跟踪不同。

我查看了 traces.txt 文件,但老实说它很大,我不确定我在找什么。我发现了这样的事情,但没有帮助:

"ActivityManager" prio=5 tid=16 TimedWaiting
| group="main" sCount=1 dsCount=0 obj=0x12d4c9e0 self=0xb7e73020
| sysTid=579 nice=-2 cgrp=default sched=0/0 handle=0xb7e73628
| state=S schedstat=( 0 0 0 ) utm=2110 stm=2446 core=1 HZ=100
| stack=0xa396a000-0xa396c000 stackSize=1036KB
| held mutexes=
at java.lang.Object.wait!(Native method)
- waiting on <0x1b396375> (a com.android.server.am.ActivityManagerService$5)
at java.lang.Object.wait(Object.java:422)
at com.android.server.am.ActivityManagerService.dumpStackTraces(ActivityManagerService.java:4800)
- locked <0x1b396375> (a com.android.server.am.ActivityManagerService$5)
at com.android.server.am.ActivityManagerService.dumpStackTraces(ActivityManagerService.java:4777)
at com.android.server.am.ActivityManagerService.appNotResponding(ActivityManagerService.java:5018)
at com.android.server.am.BroadcastQueue$AppNotResponding.run(BroadcastQueue.java:171)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.os.HandlerThread.run(HandlerThread.java:61)
at com.android.server.ServiceThread.run(ServiceThread.java:46)

我该如何调试它?


编辑

代替知道如何调试我只是破解并注释掉下面的代码允许服务继续运行所以这里的东西导致了 Gc 错误但是为什么,它与其他可用的应用程序相同?

void sendNotification(String message) {
Log.e(TAG, "send notification");

/*NotificationCompat.Builder mBuilder =
(NotificationCompat.Builder) new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.ic_notification_icon)
.setContentTitle(message)
.setContentText("since you last serviced your shocks")
.setColor(0xffCDDC39)
.setAutoCancel(true);
Intent resultIntent = new Intent(this, ActivitiesActivity.class);
TaskStackBuilder stackBuilder = TaskStackBuilder.create(this);
stackBuilder.addParentStack(ActivitiesActivity.class);
stackBuilder.addNextIntent(resultIntent);
PendingIntent resultPendingIntent =
stackBuilder.getPendingIntent(
0,
PendingIntent.FLAG_UPDATE_CURRENT
);
mBuilder.setContentIntent(resultPendingIntent);
NotificationManager mNotificationManager =
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
mNotificationManager.notify(mId, mBuilder.build());*/
}

35 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com