六狼论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博账号登陆

只需一步,快速开始

搜索
查看: 43|回复: 0

Concurrent mark

[复制链接]

升级  67.67%

123

主题

123

主题

123

主题

举人

Rank: 3Rank: 3

积分
403
 楼主| 发表于 2013-1-15 02:36:48 | 显示全部楼层 |阅读模式
<span style="font-family: Arial, sans-serif; font-size: 13px;">Concurrent mark gives reduced and consistent garbage collection pause times when heap sizes increase.
The GC starts a concurrent marking phase before the heap is full. In the concurrent phase, the GC scans the roots, i.e. stacks, JNI references, class statics, and so on. The stacks are scanned by asking each thread to scan its own stack. These roots are then used to trace live objects concurrently. Tracing is done by a low-priority background thread and by each application thread when it does a heap lock allocation.
<div style="margin-top: 0.3em;" class="p">While the GC is marking live objects concurrently with application threads running, it has to record any changes to objects that are already traced. It uses a write barrier that is run every time a reference in an object is updated. The write barrier flags when an object reference update has occurred, to force a re-scan of part of the heap. The heap is divided into 512-byte sections and each section is allocated a one-byte card in the card table. Whenever a reference to an object is updated, the card that corresponds to the start address of the object that has been updated with the new object reference is marked with 0x01. A byte is used instead of a bit to eliminate contention; it allows marking of the cards using non-atomic operations. A stop-the-world (STW) collection is started when one of the following occurs:

  • An allocation failure
  • A System.gc
  • Concurrent mark completes all the marking that it can do
您需要登录后才可以回帖 登录 | 立即注册 新浪微博账号登陆

本版积分规则

快速回复 返回顶部 返回列表