查找已弃用的 JVM 标志
Find deprecated JVM flags
我根据 Print all JVM flags 问题使用 java -XX:+PrintFlagsFinal -version
来比较我升级到 JVM 11 的不同 JDK 之间的结果。
我注意到 PrintFlagsFinal
的结果仍然 return 已弃用的选项 — 例如PrintGC
仍然存在,即使 运行 -XX:+PrintGC
发出警告并改为运行 -Xlog:gc
。
那么,是否有类似于 PrintFlagsFinal
的选项,我可以使用它来查找当前已弃用的所有选项,从而避免使用它们?
(知道我可以手动检查发行说明,但想知道是否有一种从 JVM 中查找的内置方法,类似于 jdeprscan
用于不推荐使用的模块依赖项)
有多个 "levels" 弃用:ALIASED、DEPRECATED、OBSOLETE 和 EXPIRED 标志,其含义在 arguments.cpp 中描述。
除上述类别外,还有已弃用的跟踪标志已替换为 Unified JVM Logging 选项。
最后,还有一些没有在上面列出的标志,在描述中只有 "deprecated"。
我不知道有一个地方将所有这些已弃用的标志收集在一起,但是从 JVM 源中提取它们相当容易:提到的 arguments.cpp and globals*.hpp family. I also recommend VM Options Explorer 结构良好的 table 网站HotSpot JVM 标志(按版本)。
自 JDK 11 起,deprecated/obsolete/expired 和其他不受支持的标志列表包括:
AggressiveOpts
AllowNonVirtualCalls
AssumeMP
CheckAssertionStatusDirectives
CheckEndorsedAndExtDirs
CompilerThreadHintNoPreempt
CreateMinidumpOnCrash
DefaultMaxRAMFraction
DeferPollingPageLoopCount
DeferThrSuspendLoopCount
EnableTracing
FastTLABRefill
FreqCountInvocations
IgnoreUnverifiableClassesDuringDump
InitialRAMFraction
InlineNotify
MaxGCMinorPauseMillis
MaxPermSize
MaxRAMFraction
MinRAMFraction
MonitorInUseLists
MustCallLoadClassInternal
NativeMonitorFlags
NativeMonitorSpinLimit
NativeMonitorTimeout
PermSize
PrintCompressedOopsMode
PrintGC
PrintGCDetails
PrintMalloc
PrintMallocFree
PrintSafepointStatistics
PrintSafepointStatisticsCount
PrintSafepointStatisticsTimeout
PrintSharedSpaces
SafepointSpinBeforeYield
SharedMiscCodeSize
SharedMiscDataSize
SharedReadOnlySize
SharedReadWriteSize
ShowSafepointMsgs
TraceBiasedLocking
TraceClassLoading
TraceClassLoadingPreorder
TraceClassPaths
TraceClassResolution
TraceClassUnloading
TraceExceptions
TraceJVMTIObjectTagging
TraceLoaderConstraints
TraceMonitorInflation
TraceRedefineClasses
TraceSafepointCleanupTime
TraceScavenge
UnlinkSymbolsALot
UnsyncloadClass
UseAppCDS
UseConcMarkSweepGC
UseLockedTracing
UseMembar
UseUTCFileTimestamp
VMThreadHintNoPreempt
更新
感谢@chriswhocodes,VM Options Explorer 现在显示已弃用的 JVM 标志。
如果您可以 运行 在应用程序上进行 Java 飞行记录(例如在开发设置中)并使用 Java/JDK Mission Control (>= 6.0.0) 打开它然后JMC 将分析您用于启动 JVM 的标志并告诉您其中哪些已被弃用。
我已将弃用信息添加到 https://chriswhocodes.com/hotspot_option_differences.html
的 VM 选项资源管理器
我根据 Print all JVM flags 问题使用 java -XX:+PrintFlagsFinal -version
来比较我升级到 JVM 11 的不同 JDK 之间的结果。
我注意到 PrintFlagsFinal
的结果仍然 return 已弃用的选项 — 例如PrintGC
仍然存在,即使 运行 -XX:+PrintGC
发出警告并改为运行 -Xlog:gc
。
那么,是否有类似于 PrintFlagsFinal
的选项,我可以使用它来查找当前已弃用的所有选项,从而避免使用它们?
(知道我可以手动检查发行说明,但想知道是否有一种从 JVM 中查找的内置方法,类似于 jdeprscan
用于不推荐使用的模块依赖项)
有多个 "levels" 弃用:ALIASED、DEPRECATED、OBSOLETE 和 EXPIRED 标志,其含义在 arguments.cpp 中描述。
除上述类别外,还有已弃用的跟踪标志已替换为 Unified JVM Logging 选项。
最后,还有一些没有在上面列出的标志,在描述中只有 "deprecated"。
我不知道有一个地方将所有这些已弃用的标志收集在一起,但是从 JVM 源中提取它们相当容易:提到的 arguments.cpp and globals*.hpp family. I also recommend VM Options Explorer 结构良好的 table 网站HotSpot JVM 标志(按版本)。
自 JDK 11 起,deprecated/obsolete/expired 和其他不受支持的标志列表包括:
AggressiveOpts
AllowNonVirtualCalls
AssumeMP
CheckAssertionStatusDirectives
CheckEndorsedAndExtDirs
CompilerThreadHintNoPreempt
CreateMinidumpOnCrash
DefaultMaxRAMFraction
DeferPollingPageLoopCount
DeferThrSuspendLoopCount
EnableTracing
FastTLABRefill
FreqCountInvocations
IgnoreUnverifiableClassesDuringDump
InitialRAMFraction
InlineNotify
MaxGCMinorPauseMillis
MaxPermSize
MaxRAMFraction
MinRAMFraction
MonitorInUseLists
MustCallLoadClassInternal
NativeMonitorFlags
NativeMonitorSpinLimit
NativeMonitorTimeout
PermSize
PrintCompressedOopsMode
PrintGC
PrintGCDetails
PrintMalloc
PrintMallocFree
PrintSafepointStatistics
PrintSafepointStatisticsCount
PrintSafepointStatisticsTimeout
PrintSharedSpaces
SafepointSpinBeforeYield
SharedMiscCodeSize
SharedMiscDataSize
SharedReadOnlySize
SharedReadWriteSize
ShowSafepointMsgs
TraceBiasedLocking
TraceClassLoading
TraceClassLoadingPreorder
TraceClassPaths
TraceClassResolution
TraceClassUnloading
TraceExceptions
TraceJVMTIObjectTagging
TraceLoaderConstraints
TraceMonitorInflation
TraceRedefineClasses
TraceSafepointCleanupTime
TraceScavenge
UnlinkSymbolsALot
UnsyncloadClass
UseAppCDS
UseConcMarkSweepGC
UseLockedTracing
UseMembar
UseUTCFileTimestamp
VMThreadHintNoPreempt
更新
感谢@chriswhocodes,VM Options Explorer 现在显示已弃用的 JVM 标志。
如果您可以 运行 在应用程序上进行 Java 飞行记录(例如在开发设置中)并使用 Java/JDK Mission Control (>= 6.0.0) 打开它然后JMC 将分析您用于启动 JVM 的标志并告诉您其中哪些已被弃用。
我已将弃用信息添加到 https://chriswhocodes.com/hotspot_option_differences.html