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

JNLP2ClassLoader is too greedy clonning native libraries

    Details

    • Subcomponent:
    • Resolved In Build:
      b03
    • CPU:
      generic
    • OS:
      generic
    • Verification:
      Not verified

      Backports

        Description

        Plugin classloader creates copy of native library before loading it.
        FX runtime has several native libraries and copying of the is actually expensive.

        In my experiments (on fast PC) overhead of performing copy for JMC test is over 10%.
        For other systems (slower/faster) mileage will vary but it seems impact on startup is significant.

        Separating from discussion of whether we could avoid clonning at all (at least for trusted libraries)
        there are some other things that can be improved:

        1) Do not clone libraries for first client (i.e. lock then in place and copy only if lock is already present)
           This will help benchmarks and may be many real world use cases where user does not run more than 1 FX app at time.

        2) Do not copy all libraries at once.
           As of now plugin seems to perform cloning directories and they may contain libaries that will be never used (like we likely only use decora-sse or decora-d3d). This might have some sideffect if system has another lib with same name installed and it will be pulled in as dependency for library being loaded. However, this seems to be imaginary case. In fact pulling system lib in such case might be benefitial as then we can reuse msvcp71.dll and msvcr71.dll if they are available on the system.

        3) Explore possible ways to reduce cost of cloning. (symlinks? clonning dll in the memory?)
        We still need to follow up to:
          1) plug in jar index support for lazy native libs
          2) see if we can accept sharing of the same native lib between different classloaders.
             This is generally no-no for libs using jni but for java-independent libs it might be good option
              (i.e. MS runtime libs, media codecs, etc.)

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  igor Igor Nekrestyanov (Inactive)
                  Reporter:
                  igor Igor Nekrestyanov (Inactive)
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  1 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Imported:
                    Indexed: