Mercurial > hg > graal-compiler
comparison src/share/vm/services/heapDumper.cpp @ 1046:72a6752ac432
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 | 7bb995fbd3c0 |
children | 4ce7240d622c |
comparison
equal
deleted
inserted
replaced
1045:fa2f65ebeb08 | 1046:72a6752ac432 |
---|---|
1911 } | 1911 } |
1912 // If HeapDumpPath wasn't a file name then we append the default name | 1912 // If HeapDumpPath wasn't a file name then we append the default name |
1913 if (use_default_filename) { | 1913 if (use_default_filename) { |
1914 char fn[32]; | 1914 char fn[32]; |
1915 sprintf(fn, "java_pid%d", os::current_process_id()); | 1915 sprintf(fn, "java_pid%d", os::current_process_id()); |
1916 assert(strlen(base_path) + strlen(fn) < sizeof(base_path), "HeapDumpPath too long"); | 1916 assert(strlen(base_path) + strlen(fn) + strlen(".hprof") < sizeof(base_path), "HeapDumpPath too long"); |
1917 strcat(base_path, fn); | 1917 strcat(base_path, fn); |
1918 strcat(base_path, ".hprof"); | |
1918 } | 1919 } |
1919 assert(strlen(base_path) < sizeof(my_path), "Buffer too small"); | 1920 assert(strlen(base_path) < sizeof(my_path), "Buffer too small"); |
1920 strcpy(my_path, base_path); | 1921 strcpy(my_path, base_path); |
1921 } else { | 1922 } else { |
1922 // Append a sequence number id for dumps following the first | 1923 // Append a sequence number id for dumps following the first |
1925 assert(strlen(base_path) + strlen(fn) < sizeof(my_path), "HeapDumpPath too long"); | 1926 assert(strlen(base_path) + strlen(fn) < sizeof(my_path), "HeapDumpPath too long"); |
1926 strcpy(my_path, base_path); | 1927 strcpy(my_path, base_path); |
1927 strcat(my_path, fn); | 1928 strcat(my_path, fn); |
1928 } | 1929 } |
1929 dump_file_seq++; // increment seq number for next time we dump | 1930 dump_file_seq++; // increment seq number for next time we dump |
1930 assert(strlen(".hprof") + strlen(my_path) < sizeof(my_path), "HeapDumpPath too long"); | |
1931 strcat(my_path, ".hprof"); | |
1932 | 1931 |
1933 HeapDumper dumper(false /* no GC before heap dump */, | 1932 HeapDumper dumper(false /* no GC before heap dump */, |
1934 true /* send to tty */); | 1933 true /* send to tty */); |
1935 dumper.dump(my_path); | 1934 dumper.dump(my_path); |
1936 } | 1935 } |