@@ -468,10 +468,13 @@ HeapDumpDCmd::HeapDumpDCmd(outputStream* output, bool heap) :
468468 " BOOLEAN" , false , " false" ),
469469 _gzip(" -gz" , " If specified, the heap dump is written in gzipped format "
470470 " using the given compression level. 1 (recommended) is the fastest, "
471- " 9 the strongest compression." , " INT" , false , " 1" ) {
471+ " 9 the strongest compression." , " INT" , false , " 1" ),
472+ _overwrite(" -overwrite" , " If specified, the dump file will be overwritten if it exists" ,
473+ " BOOLEAN" , false , " false" ) {
472474 _dcmdparser.add_dcmd_option (&_all);
473475 _dcmdparser.add_dcmd_argument (&_filename);
474476 _dcmdparser.add_dcmd_option (&_gzip);
477+ _dcmdparser.add_dcmd_option (&_overwrite);
475478}
476479
477480void HeapDumpDCmd::execute (DCmdSource source, TRAPS) {
@@ -490,7 +493,7 @@ void HeapDumpDCmd::execute(DCmdSource source, TRAPS) {
490493 // This helps reduces the amount of unreachable objects in the dump
491494 // and makes it easier to browse.
492495 HeapDumper dumper (!_all.value () /* request GC if _all is false*/ );
493- dumper.dump (_filename.value (), output (), (int ) level);
496+ dumper.dump (_filename.value (), output (), (int ) level, _overwrite. value () );
494497}
495498
496499ClassHistogramDCmd::ClassHistogramDCmd (outputStream* output, bool heap) :
0 commit comments