What is the understanding of "floating garbage" in JAVA: CMS garbage collection?

< H2 > the book says: during the concurrent cleanup phase, the user thread is still running, and new garbage may be generated during this period. New garbage cannot be removed this time GC, but can only be cleaned up next time. These rubbish have a professional term: floating rubbish. < / H2 >

how to understand this floating garbage? Wasn"t it discovered and cleaned up during this GC relabeling of remark? Why wait until the next time GC can clean up?

Mar.04,2021

re-mark (Remark) the function is:
before the concurrent tag, because the GC and the user program are executed concurrently, it may cause part of the object that has been marked as unreachable from the GC Roots , because the user program (concurrency) runs, can reach , and the function of Remark is to mark this part of the object as reachable object .

< hr >

as for "floating garbage", because CMS is concurrent when marks , the GC thread and the user thread execute concurrently. Of course, this process may cause the newly generated garbage (that is, floating garbage) not to be marked because of the alternate execution of threads. On the other hand, the function of remarking is only to modify the unreachable objects obtained by the previous concurrent tag , so there is no way to deal with "floating garbage".

The

remark process marks the living object, judging from the reachability of the GCRoot that the object is alive, but cannot mark the "dead" object.
if the remark process is marked alive during the initial marking phase and "dies" during the concurrent run, the remark process cannot be corrected, so it becomes floating garbage and needs to wait for the next gc to arrive.


Thank you for the invitation. Just talk about your understanding:

  • if floating garbage is constantly generated, is it true that GC, has been doing remark all the time. This will cause OOM.
Menu