Java jcmd 命令动态修改 JVM 启动参数
JVM jcmd 诊断工具 About 1,547 words说明
文中的12345
为进程的pid
。
列出所有标志
Linux
jcmd 12345 VM.flags -all | grep manageable
Windows
jcmd 12345 VM.flags -all | findstr manageable
以Java11
为例
PS C:\WINDOWS\system32> jcmd 1000 VM.flags -all | findstr manageable
intx CMSAbortablePrecleanWaitMillis = 100 {manageable} {default}
intx CMSTriggerInterval = -1 {manageable} {default}
intx CMSWaitDuration = 2000 {manageable} {default}
bool HeapDumpAfterFullGC = false {manageable} {default}
bool HeapDumpBeforeFullGC = false {manageable} {default}
bool HeapDumpOnOutOfMemoryError = false {manageable} {default}
ccstr HeapDumpPath = {manageable} {default}
uintx MaxHeapFreeRatio = 70 {manageable} {default}
uintx MinHeapFreeRatio = 40 {manageable} {default}
bool PrintClassHistogram = false {manageable} {default}
bool PrintConcurrentLocks = false {manageable} {default}
改变参数
FullGC
后Dump
出堆内存。
jcmd 12345 VM.set_flag HeapDumpAfterFullGC true
Views: 3,035 · Posted: 2021-09-18
————        END        ————
Give me a Star, Thanks:)
https://github.com/fendoudebb/LiteNote扫描下方二维码关注公众号和小程序↓↓↓
Loading...