zl程序教程

您现在的位置是:首页 >  其它

当前栏目

gc()两分钟了解JDK8默认垃圾收集器(附英文)

了解 默认 垃圾 英文 GC JDK8 收集器
2023-09-14 09:04:59 时间

Hello!today let's try to know the default GC of JDK8.You know,在JDK8中JVM(Java Virtual Machine)的参数大概总数有1850多个,有详细介绍的参数也有680之多。而这就包括使用默认垃圾收集器的参数,可以通过java -XX:+PrintCommandLineFlagsjvm -version命令打印出JDK默认使用的GC。如下图:

The default GC of JDK8

上图红框的UseParallelGC就是Parallel Scavenge(新生代)+Parallel Old(老年代),也就是说:JDK8 默认垃圾收集器是Parallel Scavenge+Parallel Old。

Parallel Scavenge
The parallel collector (also known as the throughput collector) performs minor collections in parallel, which can significantly reduce garbage collection overhead. It is intended for applications with medium-sized to large-sized data sets that are run on multiprocessor or multithreaded hardware. The parallel collector is selected by default on certain hardware and operating system configurations, or can be explicitly enabled with the option -XX:+UseParallelGC.

Parallel Scavenge收集器(也称为吞吐量收集器)以并行的方式执行小规模的收集,这可以显著降低垃圾收集开销。它适用于在多处理器或多线程硬件上运行的具有中等规模到大型数据集的应用程序。Parallel Scavenge在某些硬件和操作系统配置上是默认选择的,或者可以通过选项-XX:+UseParallelGC明确启用。

以上英文选自https://docs.oracle.com/javase/8/docs/technotes/guides/vm/gctuning/collectors.html

well so much for today.thank you for watching.see you tomorrow.