Skip to content
Permalink
Browse files
8259627: Potential memory leaks in JVMTI after JDK-8227745
Reviewed-by: shade, stuefe, dholmes, sspitsyn
  • Loading branch information
reinrich committed Jan 15, 2021
1 parent 2c8e337 commit 6d4a593f8d139f633e4942518059f1e2c0ab0384
Showing 1 changed file with 8 additions and 8 deletions.
@@ -1196,15 +1196,15 @@ JvmtiEnv::GetOwnedMonitorInfo(JavaThread* java_thread, jint* owned_monitor_count
jvmtiError err = JVMTI_ERROR_NONE;
JavaThread* calling_thread = JavaThread::current();

// growable array of jvmti monitors info on the C-heap
GrowableArray<jvmtiMonitorStackDepthInfo*> *owned_monitors_list =
new (ResourceObj::C_HEAP, mtServiceability) GrowableArray<jvmtiMonitorStackDepthInfo*>(1, mtServiceability);

EscapeBarrier eb(true, calling_thread, java_thread);
if (!eb.deoptimize_objects(MaxJavaStackTraceDepth)) {
return JVMTI_ERROR_OUT_OF_MEMORY;
}

// growable array of jvmti monitors info on the C-heap
GrowableArray<jvmtiMonitorStackDepthInfo*> *owned_monitors_list =
new (ResourceObj::C_HEAP, mtServiceability) GrowableArray<jvmtiMonitorStackDepthInfo*>(1, mtServiceability);

// It is only safe to perform the direct operation on the current
// thread. All other usage needs to use a direct handshake for safety.
if (java_thread == calling_thread) {
@@ -1246,15 +1246,15 @@ JvmtiEnv::GetOwnedMonitorStackDepthInfo(JavaThread* java_thread, jint* monitor_i
jvmtiError err = JVMTI_ERROR_NONE;
JavaThread* calling_thread = JavaThread::current();

// growable array of jvmti monitors info on the C-heap
GrowableArray<jvmtiMonitorStackDepthInfo*> *owned_monitors_list =
new (ResourceObj::C_HEAP, mtServiceability) GrowableArray<jvmtiMonitorStackDepthInfo*>(1, mtServiceability);

EscapeBarrier eb(true, calling_thread, java_thread);
if (!eb.deoptimize_objects(MaxJavaStackTraceDepth)) {
return JVMTI_ERROR_OUT_OF_MEMORY;
}

// growable array of jvmti monitors info on the C-heap
GrowableArray<jvmtiMonitorStackDepthInfo*> *owned_monitors_list =
new (ResourceObj::C_HEAP, mtServiceability) GrowableArray<jvmtiMonitorStackDepthInfo*>(1, mtServiceability);

// It is only safe to perform the direct operation on the current
// thread. All other usage needs to use a direct handshake for safety.
if (java_thread == calling_thread) {

1 comment on commit 6d4a593

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on 6d4a593 Jan 15, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.