Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8267666

Add option to jcmd GC.heap_dump to use existing file

XMLWordPrintable

    • b06

        Now GC.heap_dump expects to create a new file for heap dump and it bails out if the target file exists.

        User may want to use an existing file. It is necessary if the target file is a predefined file-like object, like a named pipe, socket,..

        This enhancement adds an option to allow to rewrite an existing file content. It also allows use-cases when the file is a file-like object.

        It can be used to add more compression methods for heap dump in addition to gzip, which is supported by JVM natively, for example on (on Linux):

            # create intermediate named FIFO
            mkfifo testfifo
            # compress with LZ4 and write to file
            lz4cat - < testfifo > dump.hprof.lz4
            # dump the heap
            jcmd Test GC.heap_dump -overwrite testfifo

        Or send the dump over network (to REMOTE:PORT)

            nc $REMOTE $PORT < testfifo
            jcmd Test GC.heap_dump -overwrite testfifo

                 

              akozlov Anton Kozlov
              akozlov Anton Kozlov
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

                Created:
                Updated:
                Resolved: