On the problem of CMS algorithm in gc recovery

https://www.cnblogs.com/ggjuc.

this article says:

< H2 > 1 CMS will not defragment the heap, so in order to prevent full gc, from causing heap fragmentation, merge the fragments by opening the CMS phase: < / H2 >

does this mean that after CMS full gc, if there are fragments, it will cause a new full gc?

< H2 > 2 enable the-XX:+CMSScavengeBeforeRemark option to force minor gc, to start before remark to reduce the pause time of remark < / H2 >

Why does forcing minor gc reduce remark pause time?

Mar.04,2021

it should be said that fragmentation is not the direct cause of Full GC, but not enough memory. Fragmentation results in less contiguous memory space, and if new contiguous chunks of memory need to be allocated, Full GC.

will be triggered.

forcing minor gc reduces remark pause time: what can be recycled has been recycled, so there is no need for remark.


question 2, in the remark phase, you need to mark the living old objects.
there are old objects referenced by the new generation of objects, and if there are many new generation objects, the scanning process will naturally take a long time.
if you first execute ygc,gc to drop useless young objects, the scanning process will naturally be faster.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3140d-2bd84.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3140d-2bd84.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?