JDK-8171401 : Release Note: Fixed memory leak when Java objects are passed into JavaScript
  • Type: Sub-task
  • Component: javafx
  • Sub-Component: web
  • Affected Version: 8u102,9
  • Priority: P3
  • Status: Closed
  • Resolution: Delivered
  • Submitted: 2016-12-17
  • Updated: 2022-06-17
  • Resolved: 2016-12-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 8
8u102Resolved
Related Reports
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
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.
Comments
8u102 Release Notes updated.
20-12-2016

A couple more bugs filed related to this change: JDK-8170085 and JDK-8089776.
17-12-2016

We have already had a few WebBugs filed that turned out to be related to this change. For example, JDK-8165302 and JDK-8168625.
17-12-2016

The fix for JDK-8089681, which was first integrated into 8u102, has an associated behavioral change that we need to document. Applications that were relying on the previous, unspecified behavior will be affected by this change. This change is documented in our latest API docs for JDK 9 (see JDK-8154127 and JDK-8169204), but we need to add this to our release note to highlight this change in behavior.
17-12-2016