Java8 默認的GC收集器是?

起源

網上很多博文都java8之前的jvm的各種設置介紹,尤其關於Java8使用哪種垃圾收集算法以及jvm方面改變沒有準確的介紹。本文主要參考Oracle官方文檔。因此會有大量英文引用。

先上結論:
默認使用ParallelGC收集器,也就是在新生代使用Parallel Scavenge收集器,老年代使用ParallelOld收集器

默認的GC算法

-XX:+PrintCommandLineFlags (具體介紹在https://docs.oracle.com/javase/8/docs/technotes/guides/troubleshoot/bugreports003.html#JSTGD524)。 我們可以使用-XX:+PrintCommandLineFlags參數打印出當前Java的默認設置。

The -XX:+PrintCommandLineFlags option can be used to verify the command-line options. This option prints all command-line flags to the VM. The command-line options can also be obtained for a running VM or core file using the jmap utility.

我的java版本是java version “1.8.0_191”。 機器是Windows10 , 16G內存, 4核8線程。

C:\Users\Lenovo>java -version
java version "1.8.0_191"
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章