diff --git a/src/hotspot/os/aix/os_aix.cpp b/src/hotspot/os/aix/os_aix.cpp index fe86adcc40a66..160969df45493 100644 --- a/src/hotspot/os/aix/os_aix.cpp +++ b/src/hotspot/os/aix/os_aix.cpp @@ -743,7 +743,7 @@ bool os::create_thread(Thread* thread, ThreadType thr_type, assert(thread->osthread() == nullptr, "caller responsible"); // Allocate the OSThread object. - OSThread* osthread = new OSThread(); + OSThread* osthread = new (std::nothrow) OSThread(); if (osthread == nullptr) { return false; } @@ -857,7 +857,7 @@ bool os::create_attached_thread(JavaThread* thread) { #endif // Allocate the OSThread object - OSThread* osthread = new OSThread(); + OSThread* osthread = new (std::nothrow) OSThread(); if (osthread == nullptr) { return false; diff --git a/src/hotspot/os/bsd/os_bsd.cpp b/src/hotspot/os/bsd/os_bsd.cpp index f4799e76a32a8..2079867bbb52d 100644 --- a/src/hotspot/os/bsd/os_bsd.cpp +++ b/src/hotspot/os/bsd/os_bsd.cpp @@ -586,7 +586,7 @@ bool os::create_thread(Thread* thread, ThreadType thr_type, assert(thread->osthread() == nullptr, "caller responsible"); // Allocate the OSThread object - OSThread* osthread = new OSThread(); + OSThread* osthread = new (std::nothrow) OSThread(); if (osthread == nullptr) { return false; } @@ -679,7 +679,7 @@ bool os::create_attached_thread(JavaThread* thread) { #endif // Allocate the OSThread object - OSThread* osthread = new OSThread(); + OSThread* osthread = new (std::nothrow) OSThread(); if (osthread == nullptr) { return false; diff --git a/src/hotspot/os/linux/os_linux.cpp b/src/hotspot/os/linux/os_linux.cpp index b6d2721343cfc..7bb99874848b2 100644 --- a/src/hotspot/os/linux/os_linux.cpp +++ b/src/hotspot/os/linux/os_linux.cpp @@ -851,7 +851,7 @@ bool os::create_thread(Thread* thread, ThreadType thr_type, assert(thread->osthread() == nullptr, "caller responsible"); // Allocate the OSThread object - OSThread* osthread = new OSThread(); + OSThread* osthread = new (std::nothrow) OSThread(); if (osthread == nullptr) { return false; } @@ -975,7 +975,7 @@ bool os::create_attached_thread(JavaThread* thread) { #endif // Allocate the OSThread object - OSThread* osthread = new OSThread(); + OSThread* osthread = new (std::nothrow) OSThread(); if (osthread == nullptr) { return false; diff --git a/src/hotspot/os/windows/os_windows.cpp b/src/hotspot/os/windows/os_windows.cpp index 3a5dade91af3d..178630f86e939 100644 --- a/src/hotspot/os/windows/os_windows.cpp +++ b/src/hotspot/os/windows/os_windows.cpp @@ -568,7 +568,7 @@ unsigned __stdcall os::win32::thread_native_entry(void* t) { static OSThread* create_os_thread(Thread* thread, HANDLE thread_handle, int thread_id) { // Allocate the OSThread object - OSThread* osthread = new OSThread(); + OSThread* osthread = new (std::nothrow) OSThread(); if (osthread == nullptr) return nullptr; // Initialize the JDK library's interrupt event. @@ -673,7 +673,7 @@ bool os::create_thread(Thread* thread, ThreadType thr_type, unsigned thread_id; // Allocate the OSThread object - OSThread* osthread = new OSThread(); + OSThread* osthread = new (std::nothrow) OSThread(); if (osthread == nullptr) { return false; }