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

Slow class loading when running with JDWP

    XMLWordPrintable

Details

    • b17

    Backports

      Description

        When debug mode is active (-agentlib:jdwp), an application spends a lot of time in JVM internals like Unsafe.defineAnonymousClass or Class.getDeclaredConstructors.Sometimes this happens on EDT and UI freezes occur.

        If we look into the code, we'll see that whenever a new class is loaded and an event about it is delivered, when a garbage collection has occurred, classTrack_processUnloads iterates over all loaded classes to see if any of them have been unloaded. This leads to O(classCount * gcCount) performance, which in case of frequent GCs (and they are frequent, especially the minor ones) is close to O(classCount^2). In IDEA, we have quite a lot of classes, especially counting all lambdas, so this results in quite significant overhead.

        Full analysis here: https://youtrack.jetbrains.com/issue/JBR-1611

        Attachments

          Issue Links

            Activity

              People

                rkennke Roman Kennke
                eushakov Egor Ushakov
                Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: