Skip to content

Commit 3cb606e

Browse files
author
David Holmes
committed
8306965: osThread allocation failures should not abort the VM
Reviewed-by: lfoltan
1 parent 4795c39 commit 3cb606e

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

src/hotspot/os/aix/os_aix.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -743,7 +743,7 @@ bool os::create_thread(Thread* thread, ThreadType thr_type,
743743
assert(thread->osthread() == nullptr, "caller responsible");
744744

745745
// Allocate the OSThread object.
746-
OSThread* osthread = new OSThread();
746+
OSThread* osthread = new (std::nothrow) OSThread();
747747
if (osthread == nullptr) {
748748
return false;
749749
}
@@ -857,7 +857,7 @@ bool os::create_attached_thread(JavaThread* thread) {
857857
#endif
858858

859859
// Allocate the OSThread object
860-
OSThread* osthread = new OSThread();
860+
OSThread* osthread = new (std::nothrow) OSThread();
861861

862862
if (osthread == nullptr) {
863863
return false;

src/hotspot/os/bsd/os_bsd.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,7 @@ bool os::create_thread(Thread* thread, ThreadType thr_type,
586586
assert(thread->osthread() == nullptr, "caller responsible");
587587

588588
// Allocate the OSThread object
589-
OSThread* osthread = new OSThread();
589+
OSThread* osthread = new (std::nothrow) OSThread();
590590
if (osthread == nullptr) {
591591
return false;
592592
}
@@ -679,7 +679,7 @@ bool os::create_attached_thread(JavaThread* thread) {
679679
#endif
680680

681681
// Allocate the OSThread object
682-
OSThread* osthread = new OSThread();
682+
OSThread* osthread = new (std::nothrow) OSThread();
683683

684684
if (osthread == nullptr) {
685685
return false;

src/hotspot/os/linux/os_linux.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -851,7 +851,7 @@ bool os::create_thread(Thread* thread, ThreadType thr_type,
851851
assert(thread->osthread() == nullptr, "caller responsible");
852852

853853
// Allocate the OSThread object
854-
OSThread* osthread = new OSThread();
854+
OSThread* osthread = new (std::nothrow) OSThread();
855855
if (osthread == nullptr) {
856856
return false;
857857
}
@@ -975,7 +975,7 @@ bool os::create_attached_thread(JavaThread* thread) {
975975
#endif
976976

977977
// Allocate the OSThread object
978-
OSThread* osthread = new OSThread();
978+
OSThread* osthread = new (std::nothrow) OSThread();
979979

980980
if (osthread == nullptr) {
981981
return false;

src/hotspot/os/windows/os_windows.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,7 @@ unsigned __stdcall os::win32::thread_native_entry(void* t) {
568568
static OSThread* create_os_thread(Thread* thread, HANDLE thread_handle,
569569
int thread_id) {
570570
// Allocate the OSThread object
571-
OSThread* osthread = new OSThread();
571+
OSThread* osthread = new (std::nothrow) OSThread();
572572
if (osthread == nullptr) return nullptr;
573573

574574
// Initialize the JDK library's interrupt event.
@@ -673,7 +673,7 @@ bool os::create_thread(Thread* thread, ThreadType thr_type,
673673
unsigned thread_id;
674674

675675
// Allocate the OSThread object
676-
OSThread* osthread = new OSThread();
676+
OSThread* osthread = new (std::nothrow) OSThread();
677677
if (osthread == nullptr) {
678678
return false;
679679
}

0 commit comments

Comments
 (0)