< prev index next >

src/share/vm/gc/parallel/psScavenge.cpp

Print this page
rev 11459 : create_thread_failed: fix errors from thread creation failures

@@ -389,11 +389,15 @@
       q->enqueue(new ScavengeRootsTask(ScavengeRootsTask::code_cache));
 
       ParallelTaskTerminator terminator(
         active_workers,
                   (TaskQueueSetSuper*) promotion_manager->stack_array_depth());
-      if (active_workers > 1) {
+        // If active_workers can exceed 1, add a StrealTask.
+        // PSPromotionManager::drain_stacks_depth() does not fully drain its
+        // stacks and expects a StealTask to complete the draining if
+        // ParallelGCThreads is > 1.
+        if (gc_task_manager()->workers() > 1) {
         for (uint j = 0; j < active_workers; j++) {
           q->enqueue(new StealTask(&terminator));
         }
       }
 
< prev index next >