I know that the CMS process of tagging is to tag all reachable objects. n the stage after the final markup, we only marked all reachable objects, not unreachable objects (or my understanding is not correct). Then when the concurrent cleanup occurs, there may be an object created by the user thread when all non-reachable space is cleared. How does CMS handle, or is there a problem with what I understand from the beginning
Asked
Active
Viewed 30 times
1
-
2Objects creating during the sweep phase are immediately marked as reachable by their creator. – Holger Nov 05 '19 at 08:27
-
Maybe [this Q&A](https://stackoverflow.com/q/2364274/2711488) helps. – Holger Nov 05 '19 at 08:36
-
What I want to describe is the object generated in the concurrent cleanup phase, maybe I don't have a good understanding of CMS. In concurrent cleanup, it is determined which objects are being cleaned? – Gallrax- Nov 05 '19 at 08:49
1 Answers
0
Normally new object will be allocated to young generation which will not interfere with CMS which is happening in old generation. But in case object is promoted from young generation to old generation, CMS handle this as following:
According to the original CMS paper:
Concurrent sweeping phase: Resume the mutators once again, and sweep concurrently over the heap, deallocating unmarked objects. Care must be taken not to deallocate newly-allocated objects. This can be accomplished by allocating objects “live” (i.e., marked), at least during this phase.
Sum it up: it is allocating object with "marked" during Concurrent sweeping phase.

didxga
- 5,935
- 4
- 43
- 58