From 4aa6f9f6c638bbe87d0228fcca0e12b53212df7e Mon Sep 17 00:00:00 2001 From: Lei Zaakjyu Date: Sat, 16 Dec 2023 13:06:01 +0800 Subject: [PATCH] fix --- src/hotspot/share/gc/g1/g1ConcurrentRefine.cpp | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/hotspot/share/gc/g1/g1ConcurrentRefine.cpp b/src/hotspot/share/gc/g1/g1ConcurrentRefine.cpp index 57d6476a0d79f..7beb7c0f5d671 100644 --- a/src/hotspot/share/gc/g1/g1ConcurrentRefine.cpp +++ b/src/hotspot/share/gc/g1/g1ConcurrentRefine.cpp @@ -90,18 +90,11 @@ jint G1ConcurrentRefineThreadControl::initialize(G1ConcurrentRefine* cr) { _cr = cr; if (max_num_threads() > 0) { - _threads.push(create_refinement_thread(0, true)); - if (_threads.at(0) == nullptr) { + uint ensure_id = UseDynamicNumberOfGCThreads ? 0 : max_num_threads() - 1; + if (!ensure_threads_created(ensure_id, true)) { vm_shutdown_during_initialization("Could not allocate primary refinement thread"); return JNI_ENOMEM; } - - if (!UseDynamicNumberOfGCThreads) { - if (!ensure_threads_created(max_num_threads() - 1, true)) { - vm_shutdown_during_initialization("Could not allocate refinement threads"); - return JNI_ENOMEM; - } - } } return JNI_OK;