1.1 --- a/src/share/vm/runtime/os.cpp Fri Jul 26 10:12:15 2013 +0200 1.2 +++ b/src/share/vm/runtime/os.cpp Thu Aug 01 17:25:10 2013 -0700 1.3 @@ -595,6 +595,22 @@ 1.4 NOT_PRODUCT(inc_stat_counter(&num_mallocs, 1)); 1.5 NOT_PRODUCT(inc_stat_counter(&alloc_bytes, size)); 1.6 1.7 +#ifdef ASSERT 1.8 + // checking for the WatcherThread and crash_protection first 1.9 + // since os::malloc can be called when the libjvm.{dll,so} is 1.10 + // first loaded and we don't have a thread yet. 1.11 + // try to find the thread after we see that the watcher thread 1.12 + // exists and has crash protection. 1.13 + WatcherThread *wt = WatcherThread::watcher_thread(); 1.14 + if (wt != NULL && wt->has_crash_protection()) { 1.15 + Thread* thread = ThreadLocalStorage::get_thread_slow(); 1.16 + if (thread == wt) { 1.17 + assert(!wt->has_crash_protection(), 1.18 + "Can't malloc with crash protection from WatcherThread"); 1.19 + } 1.20 + } 1.21 +#endif 1.22 + 1.23 if (size == 0) { 1.24 // return a valid pointer if size is zero 1.25 // if NULL is returned the calling functions assume out of memory.