--- old/src/share/vm/compiler/compileBroker.cpp 2014-02-10 13:49:05.232911465 -0800 +++ new/src/share/vm/compiler/compileBroker.cpp 2014-02-10 13:49:05.084904111 -0800 @@ -955,7 +955,7 @@ if (compiler_thread == NULL || compiler_thread->osthread() == NULL){ vm_exit_during_initialization("java.lang.OutOfMemoryError", - "unable to create new native thread"); + os::native_thread_creation_failed_msg()); } java_lang_Thread::set_thread(thread_oop(), compiler_thread); --- old/src/share/vm/gc_implementation/shared/concurrentGCThread.cpp 2014-02-10 13:49:05.842941778 -0800 +++ new/src/share/vm/gc_implementation/shared/concurrentGCThread.cpp 2014-02-10 13:49:05.696934524 -0800 @@ -31,6 +31,7 @@ #include "runtime/interfaceSupport.hpp" #include "runtime/java.hpp" #include "runtime/javaCalls.hpp" +#include "runtime/os.hpp" // CopyrightVersion 1.2 @@ -206,7 +207,7 @@ // exceptions anyway, check and abort if this fails. if (res == NULL || res->osthread() == NULL) { vm_exit_during_initialization("java.lang.OutOfMemoryError", - "unable to create new native thread"); + os::native_thread_creation_failed_msg()); } java_lang_Thread::set_thread(thread_oop(), res); java_lang_Thread::set_priority(thread_oop(), NearMaxPriority); --- old/src/share/vm/prims/jvm.cpp 2014-02-10 13:49:06.392969109 -0800 +++ new/src/share/vm/prims/jvm.cpp 2014-02-10 13:49:06.242961656 -0800 @@ -2875,10 +2875,10 @@ if (JvmtiExport::should_post_resource_exhausted()) { JvmtiExport::post_resource_exhausted( JVMTI_RESOURCE_EXHAUSTED_OOM_ERROR | JVMTI_RESOURCE_EXHAUSTED_THREADS, - "unable to create new native thread"); + os::native_thread_creation_failed_msg()); } THROW_MSG(vmSymbols::java_lang_OutOfMemoryError(), - "unable to create new native thread"); + os::native_thread_creation_failed_msg()); } Thread::start(native_thread); --- old/src/share/vm/runtime/os.cpp 2014-02-10 13:49:06.953996986 -0800 +++ new/src/share/vm/runtime/os.cpp 2014-02-10 13:49:06.808989782 -0800 @@ -362,7 +362,7 @@ // exceptions anyway, check and abort if this fails. if (signal_thread == NULL || signal_thread->osthread() == NULL) { vm_exit_during_initialization("java.lang.OutOfMemoryError", - "unable to create new native thread"); + os::native_thread_creation_failed_msg()); } java_lang_Thread::set_thread(thread_oop(), signal_thread); --- old/src/share/vm/runtime/os.hpp 2014-02-10 13:49:07.503024266 -0800 +++ new/src/share/vm/runtime/os.hpp 2014-02-10 13:49:07.360017160 -0800 @@ -807,6 +807,10 @@ # include "os_bsd_zero.hpp" #endif +#ifndef OS_NATIVE_THREAD_CREATION_FAILED_MSG +#define OS_NATIVE_THREAD_CREATION_FAILED_MSG "unable to create native thread: possibly out of memory or process/resource limits reached" +#endif + public: #ifndef PLATFORM_PRINT_NATIVE_STACK // No platform-specific code for printing the native stack. @@ -829,6 +833,9 @@ // Hint to the underlying OS that a task switch would not be good. // Void return because it's a hint and can fail. static void hint_no_preempt(); + static const char* native_thread_creation_failed_msg() { + return OS_NATIVE_THREAD_CREATION_FAILED_MSG; + } // Used at creation if requested by the diagnostic flag PauseAtStartup. // Causes the VM to wait until an external stimulus has been applied --- old/src/share/vm/runtime/serviceThread.cpp 2014-02-10 13:49:08.096053736 -0800 +++ new/src/share/vm/runtime/serviceThread.cpp 2014-02-10 13:49:07.935045734 -0800 @@ -27,6 +27,7 @@ #include "runtime/javaCalls.hpp" #include "runtime/serviceThread.hpp" #include "runtime/mutexLocker.hpp" +#include "runtime/os.hpp" #include "prims/jvmtiImpl.hpp" #include "services/gcNotifier.hpp" #include "services/diagnosticArgument.hpp" @@ -66,7 +67,7 @@ // exceptions anyway, check and abort if this fails. if (thread == NULL || thread->osthread() == NULL) { vm_exit_during_initialization("java.lang.OutOfMemoryError", - "unable to create new native thread"); + os::native_thread_creation_failed_msg()); } java_lang_Thread::set_thread(thread_oop(), thread); --- old/src/share/vm/services/attachListener.cpp 2014-02-10 13:49:08.635080518 -0800 +++ new/src/share/vm/services/attachListener.cpp 2014-02-10 13:49:08.491073362 -0800 @@ -532,7 +532,7 @@ // Check that thread and osthread were created if (listener_thread == NULL || listener_thread->osthread() == NULL) { vm_exit_during_initialization("java.lang.OutOfMemoryError", - "unable to create new native thread"); + os::native_thread_creation_failed_msg()); } java_lang_Thread::set_thread(thread_oop(), listener_thread);