JDK-8162795 : [REDO] MemberNameTable doesn't purge stale entries
  • Type: Bug
  • Component: hotspot
  • Sub-Component: jvmti
  • Affected Version: 8,9
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: x86_64
  • Submitted: 2016-07-29
  • Updated: 2018-06-22
  • Resolved: 2017-02-21
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 10 JDK 8 JDK 9
10Fixed 8u121Fixed 9 b159Fixed
Related Reports
Cloners :  
Duplicate :  
Relates :  
Relates :  
Relates :  
Description
FULL PRODUCT VERSION :


A DESCRIPTION OF THE PROBLEM :
Calling findSpecial is leaking memory.

THE PROBLEM WAS REPRODUCIBLE WITH -Xint FLAG: Did not try

THE PROBLEM WAS REPRODUCIBLE WITH -server FLAG: Yes

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
import java.lang.invoke.*;

public class Leak {
  public void callMe() {
  }
  
  public static void main(String[] args) throws Throwable {
    Leak leak = new Leak();
    
    while(true) {
      MethodHandles.Lookup lookup = MethodHandles.lookup();
      MethodType mt = MethodType.fromMethodDescriptorString("()V", Leak.class.getClassLoader());
      // findSpecial leaks some native mem
      MethodHandle mh = lookup.findSpecial(Leak.class, "callMe", mt, Leak.class);
      mh.invokeExact(leak);
    }
  }
}

EXPECTED VERSUS ACTUAL BEHAVIOR :
Expected: No increase in memory
Result: Increase in memory
REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import java.lang.invoke.*;

public class Leak {
  public void callMe() {
  }
  
  public static void main(String[] args) throws Throwable {
    Leak leak = new Leak();
    
    while(true) {
      MethodHandles.Lookup lookup = MethodHandles.lookup();
      MethodType mt = MethodType.fromMethodDescriptorString("()V", Leak.class.getClassLoader());
      // findSpecial leaks some native mem
      MethodHandle mh = lookup.findSpecial(Leak.class, "callMe", mt, Leak.class);
      mh.invokeExact(leak);
    }
  }
}
---------- END SOURCE ----------


Comments
Fix already included in 8u121-b35 under - ( JDK-8166852 )
20-03-2017

Redoing MemberNameTable changes as per 8152271. Intended for jdk9 and jdk8, while JDK-8174749 will introduce a better solution for jdk10.
21-02-2017

We are not going to fix this bug. This should be fixed with 8013267.
08-09-2016