第27课:MAT中的GC Root解析和具体类别分析

本文深入探讨了GCRoot的概念,解析其在内存管理中的作用,并详细分析了GCRoot的具体类别,包括SystemClass、JNIlocal、ThreadBlock等,帮助读者理解哪些对象可以成为GC根,以及它们是如何影响垃圾回收过程的。

内容:

    GC Root解析
    GC Root具体类别分析

一、GC Root解析

  1.MAT查看GC Root

Java Basics->GC Root

二、GC Root具体类别分析

Gc root:一个gc根就是一个对象,这个对象从堆外可以访问读取。以下一些方法可以使一个对象成为gc根。
    1.System class:被bootstrap或者system类加载器加载的类,比如rt.jar里的java.util.*;
    2.JNI local:native代码里的local变量,比如用户定义的JNI代码和JVM的内部代码;
    3.JNI global:native代码里的global变量;
    4.Thread block:当前活跃的线程block中引用的对象;
    5.Thread:已经启动并且没有stop的线程;
    6.busy monitor:被调用了wait()或者notify()或者被synchronized同步的对象,如果是synchronized方法,那么静态方法指的类,非静态方法指的是对象;
    7.java local:local变量,比如方法的入参和方法内创建的变量;
    8.native stack:native代码里的出入参数,比如file/net/IO方法以及反射的参数;
    9.finalizable:在一个队列里等待它的finalizer 运行的对象;
    10.unfinalized:一个有finalize方法的对象,还没有被finalize,同时也没有进入finalizer队列等待finalize;
    11.unreachable:不会被触碰到的对象,在MAT里被标记为root用来retain object,否则是不会在分析中出现的;
    12.java stack frame:java栈帧包含了本地变量,当dump被解析时且在preferences里设置过把栈帧当做对象,这时才会产生;
    13.unknown:位置的root类型。

 

Line 45961: 08-27 15:22:21.779190 6610 6610 I .oplus.thirdkit: isSwordfishLaunchAppEnabled_ 0 isSwordfishInstallAppEnabled_ 0 Line 45962: 08-27 15:22:21.779429 6610 6610 E .oplus.thirdkit: Unknown bits set in runtime_flags: 0x40000000 Line 45964: 08-27 15:22:21.779446 6610 6610 I .oplus.thirdkit: Using CollectorTypeCMC GC. Line 45998: 08-27 15:22:21.788088 6610 6610 E .oplus.thirdkit: Not starting debugger since process cannot load the jdwp agent. Line 46193: 08-27 15:22:21.830373 6610 6630 E .oplus.thirdkit: Could not write anonymous vdex /system_ext/framework/oat/arm64/mediatek-framework.vdex: Could not open /system_ext/framework/oat/arm64/mediatek-framework.vdex for writing Line 46206: 08-27 15:22:21.830748 6610 6630 E .oplus.thirdkit: Could not write anonymous vdex /system_ext/framework/oat/arm64/mediatek-framework.vdex: Could not open /system_ext/framework/oat/arm64/mediatek-framework.vdex for writing Line 46537: 08-27 15:22:21.949656 6610 6610 D nativeloader: Configuring product-clns-7 for unbundled product apk /product/priv-app/OplusThirdKit/OplusThirdKit.apk. target_sdk_version=35, uses_libraries=, library_path=/product/priv-app/OplusThirdKit/lib/arm64:/product/lib64:/system/product/lib64, permitted_path=/data:/mnt/expand:/data/user/0/com.oplus.thirdkit:/product/lib64:/system/product/lib64 Line 46967: 08-27 15:22:22.068019 6610 6610 I ThirdKit: DatabaseHelper: DatabaseHelper Line 47038: 08-27 15:22:22.105649 6610 6610 I ThirdKit: ThirdKitApp: onCreate Line 47599: 08-27 15:22:22.273624 6610 6610 D ThirdKit: JobManager: info id:20210809 info.isPersisted true info.getService com.oplus.thirdkit.faulthelper.job.DataJobService Line 47600: 08-27 15:22:22.273834 6610 6610 D ThirdKit: JobManager: job exists:20210809 Line 47609: 08-27 15:22:22.280008 6610 6610 D ThirdKit: JobManager: info id:20231023 info.isPersisted true info.getService com.oplus.thirdkit.faulthelper.job.DataJobService Line 47610: 08-27 15:22:22.280107 6610 6610 D ThirdKit: JobManager: job exists:20231023 Line 47628: 08-27 15:22:22.284619 6610 6610 D ThirdKit: StatisticsManager: doUpload upgrade ,eventMap = {eventType=start, versionCode=3003000, extra=na} Line 47642: 08-27 15:22:22.293474 6610 6610 D ThirdKit: NetworkReceiver: registerReceiver Line 47930: 08-27 15:22:22.332616 6610 6610 D ThirdKit: ThirdKitApp: onRegister success registerId:realme_CN_5630277f5208c68bc43cde483749d78c Line 51991: 08-27 15:22:26.097974 6610 6639 D ThirdKit: call:abnormal Line 52008: 08-27 15:22:26.101191 6610 6931 W ThirdKit: EventProcessManager: processCall method=abnormal Line 52014: 08-27 15:22:26.103499 6610 6931 D ThirdKit: BaseGuide: initData mGuideUiType=1,mGuideMode=-1,mRateType=0 Line 52019: 08-27 15:22:26.104529 6610 6931 D ThirdKit: EventProcessManager: processCall guid start execute Line 52172: 08-27 15:22:26.135151 6610 6931 D ThirdKit: AbnormalManager: processCrash begin...uiType=-1, stableType=crash, isAnr=false Line 52182: 08-27 15:22:26.138570 6610 6931 D ThirdKit: CommonUtil: Build.BRAND=realme Line 52234: 08-27 15:22:26.148451 6610 6931 D ThirdKit: Utils: requestBeanStr: {"clientMeta":{"androidVersionCode":35,"channel":"4101","colorOsCode":"","language":"zh","model":"RMX3992","region":"CN"},"upgrades":[{"pkgName":"com.taobao.taobao","verCode":10000}]} Line 53643: 08-27 15:22:26.833196 6610 6939 D ThirdKit: HttpUtils: syncTask: response = Response{protocol=http/1.1, code=200, message=OK, url=https://qualitycloud-service-cn.allawntech.com/check/update} Line 53644: 08-27 15:22:26.834402 6610 6931 D ThirdKit: MarketUpdateInfoData: parseResult: response = {"code":200,"msg":"成功","traceId":"17562793469180a5a813006283523484","data":[]} Line 53645: 08-27 15:22:26.834548 6610 6931 D ThirdKit: MarketUpdateInfoData: parseResult code:200 Line 53649: 08-27 15:22:26.839943 6610 6931 D ThirdKit: AbnormalManager: createStable mMethod=stable_system_errordialog,mGuidRate=y4.d@3e0e43f Line 53709: 08-27 15:22:26.846625 6610 6931 D ThirdKit: BaseRate: stable_system_errordialog feature switch is off Line 53715: 08-27 15:22:26.846823 6610 6931 D ThirdKit: StatisticsManager: doUpload stability ,eventMap = {eventType=NotShow, package=com.taobao.taobao, versionCode=10000, guideType=na, click=na, extra=FeatureSwitchOff} Line 53719: 08-27 15:22:26.847313 6610 6931 I ThirdKit: AbnormalManager: needShow isAllowToGuide is false! Line 53720: 08-27 15:22:26.847379 6610 6931 D ThirdKit: BaseGuide: showOnMainThread needShow is false! Line 53721: 08-27 15:22:26.847417 6610 6931 D ThirdKit: EventProcessManager: GuidExecuteListener onEnd! Line 53722: 08-27 15:22:26.847533 6610 6931 D ThirdKit: EventProcessManager: lastTime=1756264185313 Line 53725: 08-27 15:22:26.847922 6610 6931 D ThirdKit: EventProcessManager: guide is null Line 62705: 08-27 15:22:44.028427 6610 6623 W .oplus.thirdkit: ApkAssets: Deleting an ApkAssets object '<empty> and /data/app/~~bpck5V7CcHnaOGPTjJDiZQ==/com.taobao.taobao-L2Qthk8hhIYclWL5yfXxIA==/base.apk' with 1 weak references Line 79105: 08-27 15:23:01.517507 6610 6639 D ThirdKit: call:featureSwitch Line 79106: 08-27 15:23:01.518067 6610 6931 W ThirdKit: EventProcessManager: processCall method=featureSwitch Line 79108: 08-27 15:23:01.518289 6610 6931 D ThirdKit: BaseGuide: initData mGuideUiType=1,mGuideMode=-1,mRateType=0 Line 79109: 08-27 15:23:01.518367 6610 6931 D ThirdKit: EventProcessManager: processCall guid start execute解析log
最新发布
08-30
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值