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

Possible memory leak during MethodCounters initialization

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 9
    • 9
    • hotspot
    • None

      There's a small window when concurrent allocation requests can succeed (method_counters() == NULL check and set_method_counters() call) and leave unmanaged MethodCounters structures.

       http://hg.openjdk.java.net/jdk9/hs-comp/hotspot/file/tip/src/share/vm/oops/method.cpp#l384

      MethodCounters* Method::build_method_counters(Method* m, TRAPS) {
        methodHandle mh(m);
        ClassLoaderData* loader_data = mh->method_holder()->class_loader_data();
        MethodCounters* counters = MethodCounters::allocate(loader_data, CHECK_NULL);
        if (mh->method_counters() == NULL) {
          mh->set_method_counters(counters);
        } else {
          MetadataFactory::free_metadata(loader_data, counters);
        }
        return mh->method_counters();
      }

            vlivanov Vladimir Ivanov
            vlivanov Vladimir Ivanov
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: