SAP / SapMachine

An OpenJDK release maintained and supported by SAP
https://sapmachine.io
GNU General Public License v2.0
509 stars 93 forks source link

jcmd GC.heap_dump without options should write to location given by -XX:HeapDumpPath, if set #1670

Closed MBaesken closed 5 months ago

MBaesken commented 6 months ago

Currently jcmd command GC.heap_dump only works with an additionally provided file name. Syntax : GC.heap_dump [options]

In case the JVM has the XX-flag HeapDumpPath set, we should support an additional mode where the is optional. In case the filename is NOT set, we take the HeapDumpPath (file or directory).

new syntax : GC.heap_dump [options] ... has precedence over second option GC.heap_dump [options] … in case -XX:HeapDumpPath=p is set

This would be a simplification e.g. for support cases where a filename or directory is set at JVM startup with -XX:HeapDumpPath=p and writing to the path is intended/recommended for usage also in the jcmd case.

See also https://bugs.openjdk.org/browse/JDK-8327769