JVM学习笔记-跟踪收集器(Tracing Collectors)

31 篇文章 0 订阅
5 篇文章 0 订阅

 

Tracing Collectors

Tracing garbage collectors trace out the graph of object references starting with the root nodes. Objects that are encountered during the trace are marked in some way. Marking is generally done by either setting flags in the objects themselves or by setting flags in a separate bitmap. After the trace is complete, unmarked objects are known to be unreachable and can be garbage collected.

跟踪收集器追踪从根节点开始的对象引用图,在追踪过程中对活动对象打上标记。总的来说要么在对象本身设置标记,要么用一个独立的位图来设置标记,当追踪结束时,未被标记的对象就是无法触及的,从而可以被收集。

 

The basic tracing algorithm is called "mark and sweep." This name refers to the two phases of the garbage collection process. In the mark phase, the garbage collector traverses the tree of references and marks each object it encounters. In the sweep phase, unmarked objects are freed, and the resulting memory is made available to the executing program. In the Java Virtual Machine, the sweep phase must include finalization of objects.

基本的追踪算法被称作“标记并清除”。这个名字指出垃圾收集的两个阶段。标记阶段,垃圾收集器遍历引用树,为遍历到对象增加标记,清除阶段,把没有被标记的对象清除,释放其占用的内存空间,在JVM中清除对象必须包含对象的终结。

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值