Android Dalvik VM GC options 命令控制参数

本文详细解析了Dalvik虚拟机中与垃圾回收(GC)相关的参数设置,包括对象标记、验证、并发GC等特性,帮助开发者更深入地理解并优化应用性能。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

} else if (strncmp(argv[i], "-Xgc:", 5) == 0) {
    //In VM thread, there is a register map for marking each stack item's status whether it is an object or internal value. And In GC step, only object item will be marked. If this value is OFF, all stack will be marked even if the item is only an integer.
    if (strcmp(argv[i] + 5, "precise") == 0)
        gDvm.preciseGc = true;
    else if (strcmp(argv[i] + 5, "noprecise") == 0)
        gDvm.preciseGc = false;
    //Only for GC verify check
    else if (strcmp(argv[i] + 5, "preverify") == 0)
        gDvm.preVerify = true;
    else if (strcmp(argv[i] + 5, "nopreverify") == 0)
        gDvm.preVerify = false;
    else if (strcmp(argv[i] + 5, "postverify") == 0)
        gDvm.postVerify = true;
    else if (strcmp(argv[i] + 5, "nopostverify") == 0)
        gDvm.postVerify = false;
    //Open/Close Dalvik vm GC markseep is concurrent or not
    else if (strcmp(argv[i] + 5, "concurrent") == 0)
        gDvm.concurrentMarkSweep = true;
    else if (strcmp(argv[i] + 5, "noconcurrent") == 0)
        gDvm.concurrentMarkSweep = false;
    //Only for GC verify cardtable which is used for marking the concurrent marksweep dirty field
    else if (strcmp(argv[i] + 5, "verifycardtable") == 0)
        gDvm.verifyCardTable = true;
    else if (strcmp(argv[i] + 5, "noverifycardtable") == 0)
        gDvm.verifyCardTable = false; 
    else {
        dvmFprintf(stderr, "Bad value for -Xgc");
        return -1;
    }
    ALOGV("Precise GC configured %s", gDvm.preciseGc ? "ON" : "OFF");
}

主要用于控制:

  • 是否在线程栈上标记对象(precise)
  • 是否对GC进行验证(xxxVerify)
  • 是否打开并行GC(concurrent)

 

http://stackoverflow.com/questions/14235842/how-to-enable-logs-specific-to-garbage-collector-in-dalvikvm

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值