src/share/vm/runtime/os.cpp

changeset 5424
5e3b6f79d280
parent 5272
1f4355cee9a2
child 5585
f92b82d454fa
child 5612
d8e99408faad
child 6238
7ccce1a6fa4d
child 6457
94c202aa2646
equal deleted inserted replaced
5423:c29568b733d2 5424:5e3b6f79d280
593 593
594 void* os::malloc(size_t size, MEMFLAGS memflags, address caller) { 594 void* os::malloc(size_t size, MEMFLAGS memflags, address caller) {
595 NOT_PRODUCT(inc_stat_counter(&num_mallocs, 1)); 595 NOT_PRODUCT(inc_stat_counter(&num_mallocs, 1));
596 NOT_PRODUCT(inc_stat_counter(&alloc_bytes, size)); 596 NOT_PRODUCT(inc_stat_counter(&alloc_bytes, size));
597 597
598 #ifdef ASSERT
599 // checking for the WatcherThread and crash_protection first
600 // since os::malloc can be called when the libjvm.{dll,so} is
601 // first loaded and we don't have a thread yet.
602 // try to find the thread after we see that the watcher thread
603 // exists and has crash protection.
604 WatcherThread *wt = WatcherThread::watcher_thread();
605 if (wt != NULL && wt->has_crash_protection()) {
606 Thread* thread = ThreadLocalStorage::get_thread_slow();
607 if (thread == wt) {
608 assert(!wt->has_crash_protection(),
609 "Can't malloc with crash protection from WatcherThread");
610 }
611 }
612 #endif
613
598 if (size == 0) { 614 if (size == 0) {
599 // return a valid pointer if size is zero 615 // return a valid pointer if size is zero
600 // if NULL is returned the calling functions assume out of memory. 616 // if NULL is returned the calling functions assume out of memory.
601 size = 1; 617 size = 1;
602 } 618 }

mercurial