src/share/vm/runtime/thread.cpp
Print this page
*** 3470,3479 ****
--- 3470,3482 ----
ObjectMonitor::Initialize() ;
// Second phase of bootstrapping, VM is about entering multi-thread mode
MemTracker::bootstrap_multi_thread();
+ // Do not allow GC during initialization
+ GC_locker::lock();
+
// Initialize global modules
jint status = init_globals();
if (status != JNI_OK) {
delete main_thread;
*canTryAgain = false; // don't let caller call JNI_CreateJavaVM again
*** 3539,3548 ****
--- 3542,3554 ----
// Notify JVMTI agents that VM has started (JNI is up) - nop if no agents.
JvmtiExport::post_vm_start();
initialize_java_lang_classes(main_thread, CHECK_JNI_ERR);
+ // After class initialization the GC is ready to run
+ GC_locker::unlock();
+
// We need this for ClassDataSharing - the initial vm.info property is set
// with the default value of CDS "sharing" which may be reset through
// command line options.
reset_vm_info_property(CHECK_JNI_ERR);