diff --git a/src/share/vm/compiler/compileBroker.cpp b/src/share/vm/compiler/compileBroker.cpp index 6edb5c5b64776e10a2802c983ffbfb0d29c78db9..dad99ec0edca6d41a586751f2f61f915699d88e7 100644 --- a/src/share/vm/compiler/compileBroker.cpp +++ b/src/share/vm/compiler/compileBroker.cpp @@ -1845,7 +1845,7 @@ void CompileBroker::init_compiler_thread_log() { os::file_separator(), thread_id, os::current_process_id()); } - fp = fopen(file_name, "at"); + fp = fopen(file_name, "wt"); if (fp != NULL) { if (LogCompilation && Verbose) { tty->print_cr("Opening compilation log %s", file_name); diff --git a/src/share/vm/compiler/compileLog.cpp b/src/share/vm/compiler/compileLog.cpp index 9def25c08c4d3fbd32c7731f827b85d5dc3de4c5..0637fd04fe6c64bac8743ec883f9e6db5856856b 100644 --- a/src/share/vm/compiler/compileLog.cpp +++ b/src/share/vm/compiler/compileLog.cpp @@ -55,8 +55,10 @@ CompileLog::CompileLog(const char* file_name, FILE* fp, intx thread_id) } CompileLog::~CompileLog() { - delete _out; + delete _out; // Close fd in fileStream::~fileStream() _out = NULL; + // Remove partial file after merging in CompileLog::finish_log_on_error + unlink(_file); FREE_C_HEAP_ARRAY(char, _identities, mtCompiler); FREE_C_HEAP_ARRAY(char, _file, mtCompiler); } @@ -268,10 +270,9 @@ void CompileLog::finish_log_on_error(outputStream* file, char* buf, int buflen) } file->print_raw_cr(""); close(partial_fd); - unlink(partial_file); } CompileLog* next_log = log->_next; - delete log; + delete log; // Removes partial file log = next_log; } _first = NULL;