page contents

如何确定新生代和老年代用的是什么垃圾回收器

Pack 发布于 2020-02-11 17:20
阅读 516
收藏 0

如何确定新生代和老年代用的是什么垃圾回收器

319
Pack
Pack

通过命令jinfo -flags 进程ID进行查看

jinfo -flags 4032
Attaching to process ID 4032, please wait…
Debugger attached successfully.
Server compiler detected.
JVM version is 25.161-b12
Non-default VM flags: -XX:-BytecodeVerificationLocal -XX:-BytecodeVerificationRemote -XX:CICompilerCount=3 -XX:InitialHeapSize=266338304 -XX:+ManagementServer -XX:MaxHeapSize=4259315712 -XX:MaxNewSize=1419771904 -XX:MinHeapDeltaBytes=524288 -XX:NewSize=88604672 -XX:OldSize=177733632 -XX:TieredStopAtLevel=1 -XX:+UseCompressedClassPointers -XX:+UseCompressedOops -XX:+UseFastUnorderedTimeStamps -XX:-UseLargePagesIndividualAllocation -XX:+UseParallelGC

  • -XX:+UseParallelGC在JDK 8中表示启用Parallel Scavenge,Parallel Old收集器会自动启用

-XX:+UseParallelGC
Enables the use of the parallel scavenge garbage collector (also known as the throughput collector) to improve the performance of your application by leveraging multiple processors.

By default, this option is disabled and the collector is chosen automatically based on the configuration of the machine and type of the JVM. If it is enabled, then the -XX:+UseParallelOldGC option is automatically enabled, unless you explicitly disable it.
官网地址

  • -XX:+UseParallelGC在1.5_6版本之后表示启用Parallel Scavenge
    • Parallel Old收集器是否会自动启用,1.7_4之后版本会默认启动,之前版本需要手动进行开启
    • 若是不会自动启用的话,就是Serial Old收集器

-XX:-UseParallelGC Use parallel garbage collection for scavenges. (Introduced in 1.4.1)
-XX:-UseParallelOldGC Use parallel garbage collection for the full collections. Enabling this option automatically sets -XX:+UseParallelGC. (Introduced in 5.0 update 6.)
官网地址
深入Java虚拟机第二版中说Parallel Old收集器在1.6中才开始提供有待论证?
经查看JDK更新日志,发现Changes in 1.5.0_10中有6441368 hotspot garbage_collector JVM core dumps when taking class histogram with -XX:+UseParallelOldGC,说明该收集器并不是在1.6版本之后才有
更新日志地址

  • 1.5_6版本之前-XX:+UseParallelGC启用的是Parallel Scavenge,老年代无其他选择,只有Serial Old收集器
请先 登录 后评论