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 } |