changeset 953:b0651468aff7

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
author ysr
date Wed, 28 Oct 2009 11:16:42 -0700
parents 0799687b7385
children 511f4c69c1be 684c526959a9
files src/share/vm/services/heapDumper.cpp
diffstat 1 files changed, 2 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/services/heapDumper.cpp	Thu Oct 29 11:45:09 2009 -0400
+++ b/src/share/vm/services/heapDumper.cpp	Wed Oct 28 11:16:42 2009 -0700
@@ -1913,8 +1913,9 @@
     if (use_default_filename) {
       char fn[32];
       sprintf(fn, "java_pid%d", os::current_process_id());
-      assert(strlen(base_path) + strlen(fn) < sizeof(base_path), "HeapDumpPath too long");
+      assert(strlen(base_path) + strlen(fn) + strlen(".hprof") < sizeof(base_path), "HeapDumpPath too long");
       strcat(base_path, fn);
+      strcat(base_path, ".hprof");
     }
     assert(strlen(base_path) < sizeof(my_path), "Buffer too small");
     strcpy(my_path, base_path);
@@ -1927,8 +1928,6 @@
     strcat(my_path, fn);
   }
   dump_file_seq++;   // increment seq number for next time we dump
-  assert(strlen(".hprof") + strlen(my_path) < sizeof(my_path), "HeapDumpPath too long");
-  strcat(my_path, ".hprof");
 
   HeapDumper dumper(false /* no GC before heap dump */,
                     true  /* send to tty */);