提交 6c780766 编写于 作者: Y ysr

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
上级 3fddbba6
...@@ -1913,8 +1913,9 @@ void HeapDumper::dump_heap() { ...@@ -1913,8 +1913,9 @@ void HeapDumper::dump_heap() {
if (use_default_filename) { if (use_default_filename) {
char fn[32]; char fn[32];
sprintf(fn, "java_pid%d", os::current_process_id()); 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, fn);
strcat(base_path, ".hprof");
} }
assert(strlen(base_path) < sizeof(my_path), "Buffer too small"); assert(strlen(base_path) < sizeof(my_path), "Buffer too small");
strcpy(my_path, base_path); strcpy(my_path, base_path);
...@@ -1927,8 +1928,6 @@ void HeapDumper::dump_heap() { ...@@ -1927,8 +1928,6 @@ void HeapDumper::dump_heap() {
strcat(my_path, fn); strcat(my_path, fn);
} }
dump_file_seq++; // increment seq number for next time we dump 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 */, HeapDumper dumper(false /* no GC before heap dump */,
true /* send to tty */); true /* send to tty */);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册