src/hotspot/share/compiler/compileBroker.cpp
changeset 51572 d2137bd1e57d
parent 51026 510ac4c08610
child 51577 64331e014bc7
--- a/src/hotspot/share/compiler/compileBroker.cpp	Tue Aug 21 09:25:06 2018 +0200
+++ b/src/hotspot/share/compiler/compileBroker.cpp	Tue Aug 21 17:47:59 2018 +0200
@@ -1637,6 +1637,12 @@
  * out to be a problem.
  */
 void CompileBroker::shutdown_compiler_runtime(AbstractCompiler* comp, CompilerThread* thread) {
+  // Free buffer blob, if allocated
+  if (thread->get_buffer_blob() != NULL) {
+    MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
+    CodeCache::free(thread->get_buffer_blob());
+  }
+
   if (comp->should_perform_shutdown()) {
     // There are two reasons for shutting down the compiler
     // 1) compiler runtime initialization failed
@@ -1767,6 +1773,11 @@
             tty->print_cr("Removing compiler thread %s after " JLONG_FORMAT " ms idle time",
                           thread->name(), thread->idle_time_millis());
           }
+          // Free buffer blob, if allocated
+          if (thread->get_buffer_blob() != NULL) {
+            MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
+            CodeCache::free(thread->get_buffer_blob());
+          }
           return; // Stop this thread.
         }
       }