Skip to content
欢迎扫码关注公众号

JEP 363: Remove the Concurrent Mark Sweep (CMS) Garbage Collector | 移除 Concurrent Mark Sweep (CMS) 垃圾收集器

摘要

移除 Concurrent Mark Sweep(CMS)垃圾收集器。

非目标

  • 不移除其他任何垃圾收集器。
  • 不从本 JEP 所针对的发布版本之前的版本中移除 CMS 垃圾收集器。

动机

两年多前,在 JEP 291 中,我们弃用了 CMS 收集器,计划在未来的发布版本中移除它,以加速其他收集器的开发。在这段时间里,没有可信的贡献者站出来承担 CMS 的维护工作。

同时,我们也见证了两种新收集器 ZGC 和 Shenandoah 的引入,以及 G1 的进一步改进,自 JDK 6 以来,G1 一直是 CMS 的预定继承者。现在,Hotspot JVM 中可用的垃圾收集器,如果它们的性能没有超过 CMS,那么它们的开销已经足够小,现在可以安全地移除 CMS。我们期望对现有收集器的未来改进将进一步减少对 CMS 的需求。

描述

此更改将禁用 CMS 的编译,从源代码树中移除 gc/cms 目录的内容,并移除仅与 CMS 相关的选项。文档中对 CMS 的引用也将被清除。尝试使用 CMS 的测试将被移除或根据需要进行调整。

尝试通过 -XX:+UseConcMarkSweepGC 选项使用 CMS 将导致以下警告消息:

txt
Java HotSpot(TM) 64-Bit Server VM 警告:忽略选项 UseConcMarkSweepGC;\
在<版本>中已移除支持

然后,VM 将继续使用默认收集器执行。

备选方案

CMS 的代码可以保留在存储库中但不进行编译。然而,没有维护者,代码将很快变得过时,但可能会给人留下受支持的错误印象。

用户可以迁移到 G1 垃圾收集器或其他任何收集器。绝对需要 CMS 的用户仍可以在早期版本中继续使用它,只要它仍受支持即可。

Page Layout Max Width

Adjust the exact value of the page width of VitePress layout to adapt to different reading needs and screens.

Adjust the maximum width of the page layout
A ranged slider for user to choose and customize their desired width of the maximum width of the page layout can go.

Content Layout Max Width

Adjust the exact value of the document content width of VitePress layout to adapt to different reading needs and screens.

Adjust the maximum width of the content layout
A ranged slider for user to choose and customize their desired width of the maximum width of the content layout can go.