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

Too many anonymous classes that aren't unloaded

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P3 P3
    • tbd
    • 9
    • core-libs
    • None

      class hello {
          public static void main(String[] args) {
            {
              int var = 5;
              System.out.println("Hello World!" + var); // Display "Hello World!"
            }
            for (int i = 0; i < 100 ; i++) {
                // nuke the anonymous classes
                System.gc();
            }
          }
      }

      Creates 17 anonymous classes because of the concatenation of var.

      Printing in Unsafe_Define_AnonymousClass:
      There are 16 different ones of these:
      Anonymous class java.lang.invoke.LambdaForm$BMH/249515771 created host class java.lang.invoke.LambdaForm

      And one of these, which is added as a dependency to the application class loader:
      Anonymous class java.lang.invoke.LambdaForm$MH/586617651 created host class java.lang.invoke.LambdaForm

      This seems crazy inefficient. Also need to figure out why the $BMH are never unloaded.

            Unassigned Unassigned
            coleenp Coleen Phillimore
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated: