6818264: Heap dumper unexpectedly adds .hprof suffix

Wed, 28 Oct 2009 11:16:42 -0700

author
ysr
date
Wed, 28 Oct 2009 11:16:42 -0700
changeset 1481
72a6752ac432
parent 1480
fa2f65ebeb08
child 1482
beb8f45ee9f0

6818264: Heap dumper unexpectedly adds .hprof suffix
Summary: Restore old behaviour wrt HeapDumpPath; first dump goes to <file>, <n>th dump goes to <file>.<n-1>, with default value of <file> the same as before.
Reviewed-by: alanb, jcoomes, tonyp

src/share/vm/services/heapDumper.cpp file | annotate | diff | comparison | revisions
     1.1 --- a/src/share/vm/services/heapDumper.cpp	Tue Oct 27 02:42:24 2009 -0700
     1.2 +++ b/src/share/vm/services/heapDumper.cpp	Wed Oct 28 11:16:42 2009 -0700
     1.3 @@ -1913,8 +1913,9 @@
     1.4      if (use_default_filename) {
     1.5        char fn[32];
     1.6        sprintf(fn, "java_pid%d", os::current_process_id());
     1.7 -      assert(strlen(base_path) + strlen(fn) < sizeof(base_path), "HeapDumpPath too long");
     1.8 +      assert(strlen(base_path) + strlen(fn) + strlen(".hprof") < sizeof(base_path), "HeapDumpPath too long");
     1.9        strcat(base_path, fn);
    1.10 +      strcat(base_path, ".hprof");
    1.11      }
    1.12      assert(strlen(base_path) < sizeof(my_path), "Buffer too small");
    1.13      strcpy(my_path, base_path);
    1.14 @@ -1927,8 +1928,6 @@
    1.15      strcat(my_path, fn);
    1.16    }
    1.17    dump_file_seq++;   // increment seq number for next time we dump
    1.18 -  assert(strlen(".hprof") + strlen(my_path) < sizeof(my_path), "HeapDumpPath too long");
    1.19 -  strcat(my_path, ".hprof");
    1.20  
    1.21    HeapDumper dumper(false /* no GC before heap dump */,
    1.22                      true  /* send to tty */);

mercurial