Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8089681 WebView leaks memory when containing object acts as javascript callback handler
  3. JDK-8171401

Release Note: Fixed memory leak when Java objects are passed into JavaScript

    XMLWordPrintable

Details

    • web
    • Verified

    Backports

      Description

        The bug fix for JDK-8089861, which was first integrated in JDK 8u102, fixes a memory leak when Java objects are passed into JavaScript. Prior to JDK 8u102, the WebView JavaScript runtime held a strong reference to such bound objects, which prevented them from being garbage collected. After the fix for JDK-8089861, the WebView JavaScript runtime uses weak references to refer to bound Java objects. The specification was updated to make it clear that this is the intended behavior.

        Applications which rely on the previously unspecified behavior might be affected by the updated behavior if the application does not hold a strong reference to an object passed to JavaScript. In such case, the Java object might be garbage collected prematurely. The solution is to modify the application to hold a strong reference in Java code for objects that should remain live after being passed into JavaScript.

        Attachments

          Issue Links

            Activity

              People

                mbilla Murali Billa
                kcr Kevin Rushforth
                Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: