src/share/vm/runtime/os.cpp

changeset 5424
5e3b6f79d280
parent 5272
1f4355cee9a2
child 5585
f92b82d454fa
child 5612
d8e99408faad
child 6238
7ccce1a6fa4d
child 6457
94c202aa2646
     1.1 --- a/src/share/vm/runtime/os.cpp	Thu Jul 18 06:47:15 2013 -0400
     1.2 +++ b/src/share/vm/runtime/os.cpp	Wed Jul 17 13:48:15 2013 +0200
     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.

mercurial