Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8259627

Potential memory leaks in JVMTI after JDK-8227745

XMLWordPrintable

    • b06

        SonarCloud reports the potential bug:
         Potential leak of memory pointed to by 'owned_monitors_list'

        ...in code like this:

        jvmtiError
        JvmtiEnv::GetOwnedMonitorInfo(JavaThread* java_thread, jint* owned_monitor_count_ptr, jobject** owned_monitors_ptr) {
         ...

          // 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;
          }

        There are other instances, all of them near new blocks added by JDK-8227745.

              rrich Richard Reingruber
              shade Aleksey Shipilev
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: