< prev index next >

src/share/vm/jfr/recorder/jfrRecorder.cpp

Print this page
rev 9061 : 8227011: Starting a JFR recording in response to JVMTI VMInit and / or Java agent premain corrupts memory
Reviewed-by: egahlin, rwestberg

@@ -187,13 +187,10 @@
   }
 
   if (!validate_recording_options(thread)) {
     return false;
   }
-  if (!JfrJavaEventWriter::initialize()) {
-    return false;
-  }
   if (!JfrOptionSet::configure(thread)) {
     return false;
   }
 
   if (!is_enabled()) {

@@ -233,10 +230,13 @@
 
 bool JfrRecorder::create_components() {
   ResourceMark rm;
   HandleMark hm;
 
+  if (!create_java_event_writer()) {
+    return false;
+  }
   if (!create_jvmti_agent()) {
     return false;
   }
   if (!create_post_box()) {
     return false;

@@ -274,10 +274,14 @@
 static JfrStackTraceRepository* _stack_trace_repository;
 static JfrStringPool* _stringpool = NULL;
 static JfrOSInterface* _os_interface = NULL;
 static JfrThreadSampling* _thread_sampling = NULL;
 
+bool JfrRecorder::create_java_event_writer() {
+  return JfrJavaEventWriter::initialize();
+}
+
 bool JfrRecorder::create_jvmti_agent() {
   return JfrOptionSet::allow_retransforms() ? JfrJvmtiAgent::create() : true;
 }
 
 bool JfrRecorder::create_post_box() {
< prev index next >